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

Final Pieces of DB Migrations #979

Closed
23 of 29 tasks
joncodo opened this issue Dec 17, 2021 · 2 comments
Closed
23 of 29 tasks

Final Pieces of DB Migrations #979

joncodo opened this issue Dec 17, 2021 · 2 comments
Assignees
Labels
type/feature-request This issue is a proposal for something new

Comments

@joncodo
Copy link
Contributor

joncodo commented Dec 17, 2021

Previous ticket

https://github.com/merico-dev/lake/issues/806

Related tickets

#994

What works now

  • Test run migrations
  • Makefile has a new command for make models-test
  • models/test has tests for many models
  • models/factory has methods to generate models
  • Test run on a fresh DB each time
  • Migrations.md has more details
  • Finish DB tests DB Tests #972
  • We need to remove the Automigrate line in each init file. Automigrate is the thing we are trying to remove since it does not support DB migrations. (15 m)
  • Migrations get run with make dev (1h)
  • Migrations get run with docker compose commands (3h)
  • Update the main README.md with a new section on how migrations work (link to Migrations.md)
  • Move GitHub init tables into its own migrations folder
  • Do this for all plugins (Move all table creation for plugin tables to the respective plugin/migration folder)
  • Loop through all plugin folders. Run migrations from all plugin folders

Things left to do

  • Get the tests passing in CI (make sure the db is updated and migrated in ci. Run the model tests in CI as a new workflow stage in GitHub actions)
  • Try to hook up domain layer migrations with custom db and remove the schema migrations table create in the makefile. Maybe create the schema migrations table with db.automigrate?
  • DB URL as a single path and use URL.parse. https://pkg.go.dev/net/url#Parse
  • Do not hard code the Test for the test env. Can we just set the DB_NAME.
  • When running tests in the makefile, you can just prefix the command with DB_URL=xxx make test
  • HANDLE ERRORS IN THE migrations files .go (db/init.go)
  • Get make models-test working again

QA workflow: @kevin-kline

User Workflow

Notes from @kevin-kline :
I cannot test the full User workflow because there is an issue building Docker images with my M1 machine: https://docs.docker.com/desktop/mac/apple-silicon/#known-issues

  • As a user, I want to run the application from scratch and not have to run anything but docker-compose up. I should see the DB created and all tables present with no data.
  • As a user that already has collected data into my database locally, and has run 2 out of 3 migration scripts, I want to run docker-compose up and see the 3rd migration be run. I also do not want to lose any data.

Developer Workflow

Notes from @kevin-kline:
Please read individual issues for more details on QA process and conclusion. This will provide context for changes I pushed to the branch.

@joncodo joncodo added the type/feature-request This issue is a proposal for something new label Dec 17, 2021
@joncodo joncodo self-assigned this Dec 17, 2021
This was referenced Dec 17, 2021
@kevin-kline
Copy link
Contributor

New notes from @joncodo @klesh

  • Try to hook up domain layer migrations with custom db and remove the schema migrations table create in the makefile. Maybe create the schema migrations table with db.automigrate?
  • Do not hard code the Test for the test env. Can we just set the DB_NAME. No IF(env.TEST == true)
    if config.V.Get("TEST") == "true" {
    connectionString = "merico:merico@tcp(localhost:3306)/lake_test"
    }

Instead
In the makefile:
Create a new .env.test and ask configure to load this file instead

@Startrekzky
Copy link
Contributor

Future discussion can be seen in #1057

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature-request This issue is a proposal for something new
Projects
None yet
Development

No branches or pull requests

3 participants