Created
June 20, 2017 05:55
-
-
Save ayroblu/ce56b703c2d213822c68d437d17d3bbc to your computer and use it in GitHub Desktop.
Declarative DB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Init: | |
CREATE TABLE table_name( | |
id INT PRIMARY KEY | |
, name TEXT NOT NULL | |
) | |
--Later on: | |
CREATE TABLE table_name( | |
id INT PRIMARY KEY | |
, name TEXT NOT NULL | |
, age TEXT NOT NULL | |
) | |
--This leads to a migration like: | |
--up | |
ALTER TABLE table_name ADD COLUMN age TEXT NOT NULL | |
--down | |
ALTER TABLE table_name DROP COLUMN age | |
-- Couldn't we have something like react which would compare the two table declarations | |
-- and create the necessary alter table statement if required? | |
-- For simplicity purposes, this could even be a yaml declaration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment