When attempting to apply a migration with migrations set, if the emmett_schema table does not exist or if it has no records, an error occurs:
/www/venv/bin/emmett -a app migrations set -r f45113b897f5
> Setting revision to f45113b897f5 against postgres://...
Do you want to continue? [y/N]: y
Traceback (most recent call last):
File "/www/venv/bin/emmett", line 8, in <module>
sys.exit(main())
^^^^^^
File "/www/venv/lib/python3.11/site-packages/emmett/cli.py", line 513, in main
cli.main(prog_name="python -m emmett" if as_module else None)
File "/www/venv/lib/python3.11/site-packages/emmett/cli.py", line 236, in main
return super().main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/www/venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/www/venv/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/www/venv/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/www/venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/www/venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/www/venv/lib/python3.11/site-packages/click/decorators.py", line 92, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/www/venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/www/venv/lib/python3.11/site-packages/emmett/cli.py", line 509, in migrations_set
set_revision(app, dbs, revision, auto_confirm)
File "/www/venv/lib/python3.11/site-packages/emmett/orm/migrations/commands.py", line 438, in set_revision
Command(app, dals).set(revision, auto_confirm)
File "/www/venv/lib/python3.11/site-packages/emmett/orm/migrations/commands.py", line 388, in set
self._store_current_revision_(
File "/www/venv/lib/python3.11/site-packages/emmett/orm/migrations/commands.py", line 159, in _store_current_revision_
ctx.db.Schema.version == source[0]
~~~~~~^^^
IndexError: tuple index out of range
When attempting to apply a migration with migrations set, if the emmett_schema table does not exist or if it has no records, an error occurs: