From commits-return-1505-archive-asf-public=cust-asf.ponee.io@superset.incubator.apache.org Wed Sep 12 19:17:04 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id B083D18067E for ; Wed, 12 Sep 2018 19:17:03 +0200 (CEST) Received: (qmail 68845 invoked by uid 500); 12 Sep 2018 17:17:02 -0000 Mailing-List: contact commits-help@superset.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@superset.incubator.apache.org Delivered-To: mailing list commits@superset.incubator.apache.org Received: (qmail 68836 invoked by uid 99); 12 Sep 2018 17:17:02 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Sep 2018 17:17:02 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 4963982BDD; Wed, 12 Sep 2018 17:17:02 +0000 (UTC) Date: Wed, 12 Sep 2018 17:17:02 +0000 To: "commits@superset.apache.org" Subject: [incubator-superset] branch master updated: [Docs] Running DB migration (#5748) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <153677262207.26716.7145498820417925293@gitbox.apache.org> From: hugh@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: incubator-superset X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 166058d95f69cfb43e064d4cfd0c0b62a7192d06 X-Git-Newrev: 1e35030a90c93b86834364f882c9ef78fb8633f8 X-Git-Rev: 1e35030a90c93b86834364f882c9ef78fb8633f8 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. hugh pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-superset.git The following commit(s) were added to refs/heads/master by this push: new 1e35030 [Docs] Running DB migration (#5748) 1e35030 is described below commit 1e35030a90c93b86834364f882c9ef78fb8633f8 Author: Hugh A. Miles II AuthorDate: Wed Sep 12 07:16:58 2018 -1000 [Docs] Running DB migration (#5748) * Add doc to add new columns * spelling * spelling --- CONTRIBUTING.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4c83e89..3aeb68b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -570,3 +570,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_migration_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_migration_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