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

Add new ensure_version command #965

Closed
wants to merge 3 commits into from
Closed

Add new ensure_version command #965

wants to merge 3 commits into from

Conversation

kasium
Copy link
Contributor

@kasium kasium commented Nov 10, 2021

Closes #964

Description

Add a new command which creates the alembic_version table. Basically this was possible before by combining stamp and heads but was not nice to use. Using pure stamp is not possible.
Basically, the command does just call the _ensure_version_table method which existed before.

Checklist

This pull request is:

  • A documentation / typographical error fix
    • Good to go, no issue or tests are needed
  • A short code fix
    • please include the issue number, and create an issue if none exists, which
      must include a complete example of the issue. one line code fixes without an
      issue and demonstration will not be accepted.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests. one line code fixes without tests will not be accepted.
  • A new feature implementation
    • please include the issue number, and create an issue if none exists, which must
      include a complete example of how the feature would look.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests.

Have a nice day!

@CaselIT
Copy link
Member

CaselIT commented Nov 10, 2021

Looks great. Could you also add changelog entry? Similar to https://github.com/sqlalchemy/alembic/blob/main/docs/build/unreleased/test_changes.rst with also a line :tickets: 964 after tags

@kasium
Copy link
Contributor Author

kasium commented Nov 10, 2021

Looks great. Could you also add changelog entry? Similar to https://github.com/sqlalchemy/alembic/blob/main/docs/build/unreleased/test_changes.rst with also a line :tickets: 964 after tags

So a new file in the folder?

@kasium
Copy link
Contributor Author

kasium commented Nov 10, 2021

Also the 3.10 tests are failing.

___________________ EnureVersionTest.test_sql_ensure_version ___________________
[gw0] linux -- Python 3.10.0 /home/runner/work/alembic/alembic/.tox/py-sqla13/bin/python
Traceback (most recent call last):
  File "/home/runner/work/alembic/alembic/tests/test_command.py", line 1216, in test_sql_ensure_version
    command.ensure_version(self.cfg, sql=True)
  File "/home/runner/work/alembic/alembic/alembic/command.py", line 662, in ensure_version
    script = ScriptDirectory.from_config(config)
  File "/home/runner/work/alembic/alembic/alembic/script/base.py", line 204, in from_config
    return ScriptDirectory(
  File "/home/runner/work/alembic/alembic/alembic/script/base.py", line 91, in __init__
    raise util.CommandError(
alembic.util.exc.CommandError: Path doesn't exist: '/home/runner/work/alembic/alembic/scratch_test_690cc903b784/scripts'.  Please use the 'init' command to create a new scripts folder.

How can I fix this?

@CaselIT
Copy link
Member

CaselIT commented Nov 10, 2021

Looks great. Could you also add changelog entry? Similar to https://github.com/sqlalchemy/alembic/blob/main/docs/build/unreleased/test_changes.rst with also a line :tickets: 964 after tags

So a new file in the folder?

yes. the name is the same as the issue number. so 964.rst

@CaselIT
Copy link
Member

CaselIT commented Nov 10, 2021

How can I fix this?

guessing here, but I think you should add cls.env = staging_env() in setup_class

Copy link
Collaborator

@sqla-tester sqla-tester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, this is sqla-tester setting up my work on behalf of CaselIT to try to get revision a85d2ac of this pull request into gerrit so we can run tests and reviews and stuff

Copy link
Collaborator

@sqla-tester sqla-tester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, this is sqla-tester setting up my work on behalf of CaselIT to try to get revision a85d2ac of this pull request into gerrit so we can run tests and reviews and stuff

@sqla-tester
Copy link
Collaborator

New Gerrit review created for change a85d2ac: https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/3302

@CaselIT
Copy link
Member

CaselIT commented Nov 10, 2021

thanks. will import in in gerrit so we can review properly

@sqla-tester
Copy link
Collaborator

mike bayer (zzzeek) wrote:

sorry for the delay here, we have a huge backlog of issues for sqlalchemy and others

View this in Gerrit at https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/3302

@sqla-tester
Copy link
Collaborator

mike bayer (zzzeek) wrote:

thanks!

View this in Gerrit at https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/3302

@sqla-tester
Copy link
Collaborator

Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/3302 has been merged. Congratulations! :)

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

Successfully merging this pull request may close these issues.

Command to create a raw alembic_version table
3 participants