Fix dbmigration (#1277)

ENH: Support adding a '-- Generated by' comment to DDL including version and timestamp
This commit is contained in:
Roland Praml authored and Rob Bygrave committed 2018-02-26 12:37:54 +13:00
1 parent 0e219a9bc6
commit 91cb5a23fd
55 files changed
+184 -13

No files matched your search

@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_basic (
id integer generated by default as identity not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_user (
id integer generated by default as identity not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
alter table migtest_e_basic drop column old_boolean;
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_ref (
id integer generated by default as identity not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
alter table migtest_e_basic drop column new_string_field;
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_basic (
id integer auto_increment not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_user (
id integer auto_increment not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
alter table migtest_e_basic drop column old_boolean;
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_ref (
id integer auto_increment not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- drop dependencies
drop trigger migtest_e_history_history_upd;
drop view migtest_e_history_with_history;
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_basic (
id integer generated by default as identity (start with 1) not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_user (
id integer generated by default as identity (start with 1) not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
alter table migtest_e_basic drop column old_boolean;
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_ref (
id integer generated by default as identity (start with 1) not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
alter table migtest_e_basic drop column new_string_field;
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_basic (
id integer auto_increment not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_user (
id integer auto_increment not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
alter table migtest_e_basic drop column old_boolean;
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_ref (
id integer auto_increment not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- drop dependencies
drop trigger migtest_e_history_history_upd;
drop trigger migtest_e_history_history_del;
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_basic (
id number(10) not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_user (
id number(10) not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
alter table migtest_e_basic drop column old_boolean;
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_ref (
id number(10) not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
alter table migtest_e_basic drop column new_string_field;
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_basic (
id serial not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- drop dependencies
drop view if exists migtest_e_history2_with_history;
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
alter table migtest_e_basic drop column old_boolean;
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_ref (
id serial not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- drop dependencies
drop trigger if exists migtest_e_history_history_upd on migtest_e_history cascade;
drop function if exists migtest_e_history_history_version();
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_basic (
id integer not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_user (
id integer not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
alter table migtest_e_basic drop column old_boolean;
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_ref (
id integer not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
alter table migtest_e_basic drop column new_string_field;
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_basic (
id integer identity(1,1) not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_user (
id integer identity(1,1) not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
-- drop column migtest_e_basic.old_boolean;
IF (OBJECT_ID('uq_migtest_e_basic_old_boolean', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_old_boolean;
@@ -39,3 +40,4 @@ IF OBJECT_ID('fk_migtest_e_basic_eref_id', 'F') IS NOT NULL alter table migtest_
alter table migtest_e_basic drop column eref_id;
IF OBJECT_ID('migtest_e_ref', 'U') IS NOT NULL drop table migtest_e_ref;
IF OBJECT_ID('migtest_e_ref_seq', 'SO') IS NOT NULL drop sequence migtest_e_ref_seq;
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
create table migtest_e_ref (
id integer identity(1,1) not null,
@@ -1,3 +1,4 @@
-- Migrationscripts for ebean unittest
-- apply changes
-- drop column migtest_e_basic.new_string_field;
IF (OBJECT_ID('uq_migtest_e_basic_new_string_field', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_new_string_field;
@@ -104,6 +105,7 @@ IF OBJECT_ID('fk_migtest_e_softdelete_deleted', 'F') IS NOT NULL alter table mig
alter table migtest_e_softdelete drop column deleted;
IF OBJECT_ID('migtest_e_user', 'U') IS NOT NULL drop table migtest_e_user;
IF OBJECT_ID('migtest_e_user_seq', 'SO') IS NOT NULL drop sequence migtest_e_user_seq;
-- dropping history support for migtest_e_history;
delimiter $$
DECLARE @Tmp nvarchar(200);select @Tmp = t1.name from sys.default_constraints t1