8000 GitHub - nvcnvn/sql-up: Always forward schema migration
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

nvcnvn/sql-up

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sql-up

Always forward schema migration because you cannot just rollback in production.

Usage

sql-up --dbms postgres --connection-string <connection-string> --sql-file <sql-file>

sql-up will apply the migration after lasted-non applied magic marker -- sql-up in the SQL file.

-- sql-up
-- Create table
CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  name TEXT NOT NULL
);

-- sql-up
ALTER TABLE users ADD COLUMN email TEXT NULL;

-- sql-up
ALTER TABLE users ADD COLUMN address TEXT NULL;

sql-up does that by creating a new table sql_up in the database to store the last applied file content and compare with the input file content to determine the migration. This mean the SQL file must be append-only.

Supported Databases and Connection String

About

Always forward schema migration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 
0