Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

it's not migrate well with nosql database #29

Open
yespk opened this issue Nov 9, 2021 · 2 comments
Open

it's not migrate well with nosql database #29

yespk opened this issue Nov 9, 2021 · 2 comments

Comments

@yespk
Copy link

yespk commented Nov 9, 2021

Whenever I migrate the jet.dashboard app

(main-venv) satya@satya:~/PycharmProjects/djangoProject/main_proj$ python manage.py migrate

Operations to perform:
Apply all migrations: admin, android_api, auth, contenttypes, jet, sessions
Running migrations:
Applying jet.0003_auto_20201228_1540...Not implemented alter command for SQL ALTER TABLE "jet_pinnedapplication" ALTER COLUMN "user_id" TYPE int
Traceback (most recent call last):
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/cursor.py", line 51, in execute
self.result = Query(
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/sql2mongo/query.py", line 784, in init
self._query = self.parse()
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/sql2mongo/query.py", line 876, in parse
raise e
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/sql2mongo/query.py", line 857, in parse
return handler(self, statement)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/sql2mongo/query.py", line 889, in _alter
query = AlterQuery(self.db, self.connection_properties, sm, self._params)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/sql2mongo/query.py", line 425, in init
super().init(*args)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/sql2mongo/query.py", line 84, in init
super().init(*args)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/sql2mongo/query.py", line 62, in init
self.parse()
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/sql2mongo/query.py", line 441, in parse
self._alter(statement)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/sql2mongo/query.py", line 500, in _alter
raise SQLDecodeError(f'Unknown token: {tok}')
djongo.exceptions.SQLDecodeError:

    Keyword: Unknown token: TYPE
    Sub SQL: None
    FAILED SQL: ('ALTER TABLE "jet_pinnedapplication" ALTER COLUMN "user_id" TYPE int',)
    Params: ([],)
    Version: 1.3.6

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/cursor.py", line 59, in execute
raise db_exe from e
djongo.database.DatabaseError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "manage.py", line 22, in
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/core/management/init.py", line 419, in execute_from_command_line
utility.execute()
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/core/management/init.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/core/management/base.py", line 89, in wrapped
res = handle_func(*args, **kwargs)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 244, in handle
post_migrate_state = executor.migrate(
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 227, in apply_migration
state = migration.apply(state, schema_editor)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/migrations/migration.py", line 126, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/migrations/operations/fields.py", line 244, in database_forwards
schema_editor.alter_field(from_model, from_field, to_field)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/backends/base/schema.py", line 608, in alter_field
self._alter_field(model, old_field, new_field, old_type, new_type,
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/backends/base/schema.py", line 765, in _alter_field
self.execute(
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/backends/base/schema.py", line 145, in execute
cursor.execute(sql, params)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 98, in execute
return super().execute(sql, params)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/utils.py", line 90, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/cursor.py", line 59, in execute
raise db_exe from e
django.db.utils.DatabaseError

@mohammedyousuf051
Copy link

Whenever I migrate the jet.dashboard app

(main-venv) satya@satya:~/PycharmProjects/djangoProject/main_proj$ python manage.py migrate

Operations to perform: Apply all migrations: admin, android_api, auth, contenttypes, jet, sessions Running migrations: Applying jet.0003_auto_20201228_1540...Not implemented alter command for SQL ALTER TABLE "jet_pinnedapplication" ALTER COLUMN "user_id" TYPE int Traceback (most recent call last): File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/cursor.py", line 51, in execute self.result = Query( File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/sql2mongo/query.py", line 784, in init self._query = self.parse() File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/sql2mongo/query.py", line 876, in parse raise e File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/sql2mongo/query.py", line 857, in parse return handler(self, statement) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/sql2mongo/query.py", line 889, in _alter query = AlterQuery(self.db, self.connection_properties, sm, self._params) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/sql2mongo/query.py", line 425, in init super().init(*args) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/sql2mongo/query.py", line 84, in init super().init(*args) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/sql2mongo/query.py", line 62, in init self.parse() File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/sql2mongo/query.py", line 441, in parse self._alter(statement) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/sql2mongo/query.py", line 500, in _alter raise SQLDecodeError(f'Unknown token: {tok}') djongo.exceptions.SQLDecodeError:

    Keyword: Unknown token: TYPE
    Sub SQL: None
    FAILED SQL: ('ALTER TABLE "jet_pinnedapplication" ALTER COLUMN "user_id" TYPE int',)
    Params: ([],)
    Version: 1.3.6

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/cursor.py", line 59, in execute raise db_exe from e djongo.database.DatabaseError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "manage.py", line 22, in main() File "manage.py", line 18, in main execute_from_command_line(sys.argv) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/core/management/init.py", line 419, in execute_from_command_line utility.execute() File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/core/management/init.py", line 413, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argv self.execute(*args, **cmd_options) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/core/management/base.py", line 398, in execute output = self.handle(*args, **options) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/core/management/base.py", line 89, in wrapped res = handle_func(*args, **kwargs) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 244, in handle post_migrate_state = executor.migrate( File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 117, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 227, in apply_migration state = migration.apply(state, schema_editor) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/migrations/migration.py", line 126, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/migrations/operations/fields.py", line 244, in database_forwards schema_editor.alter_field(from_model, from_field, to_field) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/backends/base/schema.py", line 608, in alter_field self._alter_field(model, old_field, new_field, old_type, new_type, File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/backends/base/schema.py", line 765, in _alter_field self.execute( File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/backends/base/schema.py", line 145, in execute cursor.execute(sql, params) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 98, in execute return super().execute(sql, params) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 66, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers return executor(sql, params, many, context) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/utils.py", line 90, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/home/satya/PycharmProjects/djangoProject/main_proj/main-venv/lib/python3.8/site-packages/djongo/cursor.py", line 59, in execute raise db_exe from e django.db.utils.DatabaseError

@mohammedyousuf051
Copy link

Mostly this bug can be resolved by changing the database name in the settings.py file if the database is set up locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants