jazzband / django-redshift-backend

Redshift database backend for Django
Apache License 2.0
83 stars 47 forks source link

Error on migrate: 'DatabaseSchemaEditor' object has no attribute 'sql_create_table_unique' #18

Closed pacocampo closed 7 years ago

pacocampo commented 7 years ago

Hi Guys,

When I try to migrate my models to redshit I got this error: 'DatabaseSchemaEditor' object has no attribute 'sql_create_table_unique'

I'm using : Django 1.10, python 2.7 and django-redshift-backend 0.5

All trace : Operations to perform: Apply all migrations: admin, auth, authtoken, contenttypes, dashboard, sessions Running migrations: Rendering model states... DONE Applying auth.0001_initial...Traceback (most recent call last): File "./manage.py", line 10, in execute_from_command_line(sys.argv) File "/usr/local/lib64/python2.7/site-packages/django/core/management/init.py", line 367, in execute_from_command_line utility.execute() File "/usr/local/lib64/python2.7/site-packages/django/core/management/init.py", line 359, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib64/python2.7/site-packages/django/core/management/base.py", line 305, in run_from_argv self.execute(*args, *cmd_options) File "/usr/local/lib64/python2.7/site-packages/django/core/management/base.py", line 356, in execute output = self.handle(args, **options) File "/usr/local/lib64/python2.7/site-packages/django/core/management/commands/migrate.py", line 202, in handle targets, plan, fake=fake, fake_initial=fake_initial File "/usr/local/lib64/python2.7/site-packages/django/db/migrations/executor.py", line 97, in migrate state = self._migrate_all_forwards(plan, full_plan, fake=fake, fake_initial=fake_initial) File "/usr/local/lib64/python2.7/site-packages/django/db/migrations/executor.py", line 132, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "/usr/local/lib64/python2.7/site-packages/django/db/migrations/executor.py", line 237, in apply_migration state = migration.apply(state, schema_editor) File "/usr/local/lib64/python2.7/site-packages/django/db/migrations/migration.py", line 129, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "/usr/local/lib64/python2.7/site-packages/django/db/migrations/operations/models.py", line 96, in database_forwards schema_editor.create_model(model) File "/usr/local/lib/python2.7/site-packages/django_redshift_backend/base.py", line 164, in create_model column_sqls.append(self.sql_create_table_unique % { AttributeError: 'DatabaseSchemaEditor' object has no attribute 'sql_create_table_unique'

Has it happened to someone else?

Thank you fellows

sindrig commented 7 years ago

I removed admin and auth from settings.INSTALLED_APPS as I was not using them. The migrations in there modify a non-null column, and the "create-update-drop-rename" method for migrations doesn't work for that.

alejandrocarlos commented 7 years ago

I've been trying to setup a new table in redshift and I'm facing the same issue.

shimizukawa commented 7 years ago

Definitely it's a bug of django-redshift-backend. Django-1.9 remove sql_create_table_unique attribute.

django-redshift-backend still supports django-1.8, so I have to if/else statement around there. I will fix this.

shimizukawa commented 7 years ago

fixed. It will be released around next weekend.