From e40975621b14daf260ea1396783fc2297f861768 Mon Sep 17 00:00:00 2001 From: "Lance E Sloan (lsloan)" Date: Wed, 10 Jun 2020 16:16:38 -0400 Subject: [PATCH 1/2] =?UTF-8?q?#183=20-=20define=20MiVideo=20course=20?= =?UTF-8?q?=E2=86=92=20media=20relationship?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrations/0021.add_mivideo_fk.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 db/migrations/0021.add_mivideo_fk.py diff --git a/db/migrations/0021.add_mivideo_fk.py b/db/migrations/0021.add_mivideo_fk.py new file mode 100644 index 0000000..23724d7 --- /dev/null +++ b/db/migrations/0021.add_mivideo_fk.py @@ -0,0 +1,19 @@ +''' +Migration to add MiVideo table foreign key +''' + +from yoyo import step + +__depends__ = {'0016.add_mivideo_creation_tables'} + +steps = [ + step(''' + ALTER TABLE mivideo_media_courses + ADD CONSTRAINT fk_media_id + FOREIGN KEY (media_id) + REFERENCES mivideo_media_created(id) + ON UPDATE CASCADE + ON DELETE CASCADE; + '''), + +] From fedd80352e66541b72c23a3f5ecd04b1c459183b Mon Sep 17 00:00:00 2001 From: "Lance E Sloan (lsloan)" Date: Wed, 10 Jun 2020 16:18:35 -0400 Subject: [PATCH 2/2] #183 - fix spacing --- db/migrations/0021.add_mivideo_fk.py | 1 - 1 file changed, 1 deletion(-) diff --git a/db/migrations/0021.add_mivideo_fk.py b/db/migrations/0021.add_mivideo_fk.py index 23724d7..75970cc 100644 --- a/db/migrations/0021.add_mivideo_fk.py +++ b/db/migrations/0021.add_mivideo_fk.py @@ -15,5 +15,4 @@ ON UPDATE CASCADE ON DELETE CASCADE; '''), - ]