'Tests the CreateModel operation directly followed by an
AlterUniqueTogether (bug #22844 - sqlite remake issues)'

def test_create_model_with_unique_after(self):

    operation1 = migrations.CreateModel('Pony', [('id', models.AutoField(primary_key=True)), ('pink', models.IntegerField(default=1))])
    operation2 = migrations.CreateModel('Rider', [('id', models.AutoField(primary_key=True)), ('number', models.IntegerField(default=1)), ('pony', models.ForeignKey('test_crmoua.Pony', models.CASCADE))])
    operation3 = migrations.AlterUniqueTogether('Rider', [('number', 'pony')])
    project_state = ProjectState()
    self.assertTableNotExists('test_crmoua_pony')
    self.assertTableNotExists('test_crmoua_rider')
    with connection.schema_editor() as editor:
        new_state = project_state.clone()
        operation1.state_forwards('test_crmoua', new_state)
        operation1.database_forwards('test_crmoua', editor, project_state, new_state)
        (project_state, new_state) = (new_state, new_state.clone())
        operation2.state_forwards('test_crmoua', new_state)
        operation2.database_forwards('test_crmoua', editor, project_state, new_state)
        (project_state, new_state) = (new_state, new_state.clone())
        operation3.state_forwards('test_crmoua', new_state)
        operation3.database_forwards('test_crmoua', editor, project_state, new_state)
    self.assertTableExists('test_crmoua_pony')
    self.assertTableExists('test_crmoua_rider')
