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

Proposition for a new architecture #40

Open
ewjoachim opened this issue Dec 13, 2019 · 1 comment
Open

Proposition for a new architecture #40

ewjoachim opened this issue Dec 13, 2019 · 1 comment

Comments

@ewjoachim
Copy link
Contributor

ewjoachim commented Dec 13, 2019

Here's what we would do in septentrion migrate, in order.
The idea is that as much as possible, we avoid mixing decision making and I/O.

  • Create the migration table if not exsists
  • Read existing migrations in the DB
  • Read existing migration versions and filenames in the file system
  • Decide whether to initialize the DB with a schema
  • Compute the list of migrations to run
  • migrate(fixtures before schema)
  • migrate(schema)
  • migrate(fixtures after schema)
  • For each migration:
    • Fake it if boolean says to fake it or
    • migrate(migration)
    • Write the migration in the table as executed

def migrate(migration):

  • Read the migration file content
  • Parse the migration (meta, sqlparse statements, clean (\timing), etc)
  • For each statement (including meta loops):
    • Execute it
@ewjoachim
Copy link
Contributor Author

migrate will yield at every statement, with some info regarding the execution.
The caller will receive a list of event, and can then display them.

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

1 participant