mirror of
https://github.com/djrobstep/migra.git
synced 2024-09-11 05:45:51 +03:00
proper schema tracking
This commit is contained in:
parent
85ca4bc84d
commit
393dc2b7ce
1
.gitignore
vendored
1
.gitignore
vendored
@ -27,6 +27,7 @@ pip-log.txt
|
||||
.coverage
|
||||
.tox
|
||||
nosetests.xml
|
||||
.pytest_cache
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
|
@ -6,6 +6,7 @@ from functools import partial
|
||||
from collections import OrderedDict as od
|
||||
|
||||
THINGS = [
|
||||
'schemas',
|
||||
'enums',
|
||||
'sequences',
|
||||
'constraints',
|
||||
|
@ -56,6 +56,8 @@ class Migration(object):
|
||||
self.statements.safe = safety_on
|
||||
|
||||
def add_all_changes(self):
|
||||
self.add(self.changes.schemas(creations_only=True))
|
||||
|
||||
self.add(self.changes.extensions(creations_only=True))
|
||||
self.add(self.changes.enums(creations_only=True, modifications=False))
|
||||
self.add(self.changes.sequences(creations_only=True))
|
||||
@ -84,6 +86,8 @@ class Migration(object):
|
||||
self.add(self.changes.pk_constraints(creations_only=True))
|
||||
self.add(self.changes.non_pk_constraints(creations_only=True))
|
||||
|
||||
self.add(self.changes.schemas(drops_only=True))
|
||||
|
||||
@property
|
||||
def sql(self):
|
||||
return self.statements.sql
|
||||
|
2
setup.py
2
setup.py
@ -8,7 +8,7 @@ readme = io.open('README.md').read()
|
||||
|
||||
setup(
|
||||
name='migra',
|
||||
version='1.0.1509328651',
|
||||
version='1.0.1519192543',
|
||||
url='https://github.com/djrobstep/migra',
|
||||
description='Like diff but for PostgreSQL schemas',
|
||||
long_description=readme,
|
||||
|
@ -1,5 +1,8 @@
|
||||
create extension pg_trgm;
|
||||
|
||||
create schema goodschema;
|
||||
create schema badschema;
|
||||
|
||||
CREATE TYPE shipping_status AS ENUM ('not shipped', 'shipped');
|
||||
|
||||
CREATE TYPE unwanted_enum AS ENUM ('unwanted', 'not wanted');
|
||||
|
@ -1,6 +1,9 @@
|
||||
create extension hstore;
|
||||
create extension citext;
|
||||
|
||||
create schema goodschema;
|
||||
create schema evenbetterschema;
|
||||
|
||||
CREATE TYPE shipping_status AS ENUM ('not shipped', 'shipped', 'delivered');
|
||||
|
||||
CREATE TYPE bug_status AS ENUM ('new', 'open', 'closed');
|
||||
|
@ -1,3 +1,5 @@
|
||||
create schema if not exists "evenbetterschema";
|
||||
|
||||
create extension "citext" with schema "public" version '1.4';
|
||||
|
||||
create extension "hstore" with schema "public" version '1.4';
|
||||
@ -148,3 +150,5 @@ alter table "public"."order_items" add constraint "order_items_product_no_fkey"
|
||||
alter table "public"."products" add constraint "y" CHECK ((price > (0)::numeric));
|
||||
|
||||
alter table "public"."products" add constraint "x" CHECK ((price > (10)::numeric));
|
||||
|
||||
drop schema if exists "badschema";
|
||||
|
@ -1,3 +1,5 @@
|
||||
create schema if not exists "evenbetterschema";
|
||||
|
||||
create extension "citext" with schema "public" version '1.4';
|
||||
|
||||
create extension "hstore" with schema "public" version '1.4';
|
||||
@ -144,3 +146,5 @@ alter table "public"."order_items" add constraint "order_items_product_no_fkey"
|
||||
alter table "public"."products" add constraint "y" CHECK ((price > (0)::numeric));
|
||||
|
||||
alter table "public"."products" add constraint "x" CHECK ((price > (10)::numeric));
|
||||
|
||||
drop schema if exists "badschema";
|
||||
|
Loading…
Reference in New Issue
Block a user