From f5bd7a36e20edd2ed9bac0576c7c8da6189d36d1 Mon Sep 17 00:00:00 2001 From: Hugh Miles Date: Mon, 27 Aug 2018 17:07:20 -0700 Subject: [PATCH 1/3] Add doc to add new columns --- CONTRIBUTING.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a20006354e9c3..c8135e1c0aa4b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -523,3 +523,36 @@ migration hashes. Then run `superset db merge {PASTE_SHA1_HERE} {PASTE_SHA2_HERE}`. This will create a new merge migration. You can then `superset db upgrade` to this new checkpoint. + + +## Running DB migration + +1. First alter the model you want to change. For example I want to add a `Column` Annotations model. + +https://github.com/apache/incubator-superset/commit/6c25f549384d7c2fc288451222e50493a7b14104 + + +2. superset db migrate -m "this_will_be_in_the_magration_filename" + +For our example we'll be running this command: +``` +superset db migrate -m "add_metadata_column_to_annotation_model.py" +``` + +This will generate a file in `superset/migrations/version/{SHA}_this_will_be_in_the_magration_filename.py` + +https://github.com/apache/incubator-superset/commit/d3e83b0fd572c9d6c1297543d415a332858e262 + +3. Run `superset db upgrade` + +The output should look like this: +``` +INFO [alembic.runtime.migration] Context impl SQLiteImpl. +INFO [alembic.runtime.migration] Will assume transactional DDL. +INFO [alembic.runtime.migration] Running upgrade 1a1d627ebd8e -> 40a0a483dd12, add_metadata_column_to_annotation_model.py +``` + +4. Add column to view +Since there is a new column, we need to add it to the AppBuilder Model view. + +https://github.com/apache/incubator-superset/pull/5745/commits/6220966e2a0a0cf3e6d87925491f8920fe8a3458 From 68253cbac518cbfb9bd89402af908250ff939cb0 Mon Sep 17 00:00:00 2001 From: Hugh Miles Date: Mon, 27 Aug 2018 17:12:00 -0700 Subject: [PATCH 2/3] spelling --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c8135e1c0aa4b..9c14bc7fc502a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -532,7 +532,7 @@ checkpoint. https://github.com/apache/incubator-superset/commit/6c25f549384d7c2fc288451222e50493a7b14104 -2. superset db migrate -m "this_will_be_in_the_magration_filename" +2. superset db migrate -m "this_will_be_in_the_migration_filename" For our example we'll be running this command: ``` From 1c30388975242fb9532ca97ecefdb37c9e60f422 Mon Sep 17 00:00:00 2001 From: Hugh Miles Date: Mon, 27 Aug 2018 17:12:22 -0700 Subject: [PATCH 3/3] spelling --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9c14bc7fc502a..474ce947403c9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -539,7 +539,7 @@ For our example we'll be running this command: superset db migrate -m "add_metadata_column_to_annotation_model.py" ``` -This will generate a file in `superset/migrations/version/{SHA}_this_will_be_in_the_magration_filename.py` +This will generate a file in `superset/migrations/version/{SHA}_this_will_be_in_the_migration_filename.py` https://github.com/apache/incubator-superset/commit/d3e83b0fd572c9d6c1297543d415a332858e262