mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-19 23:02:24 +00:00
Sql-scripts
This commit is contained in:
1 parent
1529a2f12b
commit
9bcba0b80d
18 files changed
+86
-114
No files matched your search
@@ -37,11 +37,12 @@ IF OBJECT_ID('fk_migtest_fk_set_null_one_id', 'F') IS NOT NULL alter table migte
|
||||
alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id);
|
||||
|
||||
update migtest_e_basic set status = 'A' where status is null;
|
||||
IF (OBJECT_ID('ck_migtest_e_basic_status', 'C') IS NOT NULL) alter table migtest_e_basic drop constraint ck_migtest_e_basic_status;
|
||||
alter table migtest_e_basic add default 'A' for status;
|
||||
IF OBJECT_ID('ck_migtest_e_basic_status', 'C') IS NOT NULL alter table migtest_e_basic drop constraint ck_migtest_e_basic_status;
|
||||
EXEC usp_ebean_drop_default_constraint migtest_e_basic, status;
|
||||
alter table migtest_e_basic alter column status nvarchar(1) not null;
|
||||
alter table migtest_e_basic add default 'A' for status;
|
||||
alter table migtest_e_basic add constraint ck_migtest_e_basic_status check ( status in ('N','A','I','?'));
|
||||
IF (OBJECT_ID('ck_migtest_e_basic_status2', 'C') IS NOT NULL) alter table migtest_e_basic drop constraint ck_migtest_e_basic_status2;
|
||||
IF OBJECT_ID('ck_migtest_e_basic_status2', 'C') IS NOT NULL alter table migtest_e_basic drop constraint ck_migtest_e_basic_status2;
|
||||
EXEC usp_ebean_drop_default_constraint migtest_e_basic, status2;
|
||||
alter table migtest_e_basic alter column status2 nvarchar(127);
|
||||
|
||||
@@ -61,20 +62,21 @@ alter table migtest_e_basic add constraint ck_migtest_e_basic_progress check ( p
|
||||
alter table migtest_e_basic add new_integer integer default 42 not null;
|
||||
|
||||
IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_indextest2') drop index uq_migtest_e_basic_indextest2 ON migtest_e_basic;
|
||||
IF (OBJECT_ID('uq_migtest_e_basic_indextest2', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest2;
|
||||
IF OBJECT_ID('uq_migtest_e_basic_indextest2', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest2;
|
||||
IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_indextest6') drop index uq_migtest_e_basic_indextest6 ON migtest_e_basic;
|
||||
IF (OBJECT_ID('uq_migtest_e_basic_indextest6', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest6;
|
||||
IF OBJECT_ID('uq_migtest_e_basic_indextest6', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest6;
|
||||
create unique nonclustered index uq_migtest_e_basic_status_indextest1 on migtest_e_basic(status,indextest1) where indextest1 is not null;
|
||||
create unique nonclustered index uq_migtest_e_basic_name on migtest_e_basic(name) where name is not null;
|
||||
create unique nonclustered index uq_migtest_e_basic_indextest4 on migtest_e_basic(indextest4) where indextest4 is not null;
|
||||
create unique nonclustered index uq_migtest_e_basic_indextest5 on migtest_e_basic(indextest5) where indextest5 is not null;
|
||||
IF (OBJECT_ID('ck_migtest_e_enum_test_status', 'C') IS NOT NULL) alter table migtest_e_enum drop constraint ck_migtest_e_enum_test_status;
|
||||
IF OBJECT_ID('ck_migtest_e_enum_test_status', 'C') IS NOT NULL alter table migtest_e_enum drop constraint ck_migtest_e_enum_test_status;
|
||||
alter table migtest_e_history alter column test_string numeric(19);
|
||||
|
||||
-- NOTE: table has @History - special migration may be necessary
|
||||
update migtest_e_history2 set test_string = 'unknown' where test_string is null;
|
||||
alter table migtest_e_history2 add default 'unknown' for test_string;
|
||||
EXEC usp_ebean_drop_default_constraint migtest_e_history2, test_string;
|
||||
alter table migtest_e_history2 alter column test_string nvarchar(255) not null;
|
||||
alter table migtest_e_history2 add default 'unknown' for test_string;
|
||||
alter table migtest_e_history2 add test_string2 nvarchar(255);
|
||||
alter table migtest_e_history2 add test_string3 nvarchar(255) default 'unknown' not null;
|
||||
alter table migtest_e_history2 add new_column nvarchar(20);
|
||||
@@ -85,8 +87,9 @@ alter table migtest_e_history5 add test_boolean bit default 0 not null;
|
||||
|
||||
-- NOTE: table has @History - special migration may be necessary
|
||||
update migtest_e_history6 set test_number1 = 42 where test_number1 is null;
|
||||
alter table migtest_e_history6 add default 42 for test_number1;
|
||||
EXEC usp_ebean_drop_default_constraint migtest_e_history6, test_number1;
|
||||
alter table migtest_e_history6 alter column test_number1 integer not null;
|
||||
alter table migtest_e_history6 add default 42 for test_number1;
|
||||
alter table migtest_e_history6 alter column test_number2 integer;
|
||||
alter table migtest_e_softdelete add deleted bit default 0 not null;
|
||||
|
||||
|
||||
@@ -15,39 +15,41 @@ IF OBJECT_ID('fk_migtest_fk_none_one_id', 'F') IS NOT NULL alter table migtest_f
|
||||
IF OBJECT_ID('fk_migtest_fk_none_via_join_one_id', 'F') IS NOT NULL alter table migtest_fk_none_via_join drop constraint fk_migtest_fk_none_via_join_one_id;
|
||||
IF OBJECT_ID('fk_migtest_fk_set_null_one_id', 'F') IS NOT NULL alter table migtest_fk_set_null drop constraint fk_migtest_fk_set_null_one_id;
|
||||
alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null;
|
||||
IF (OBJECT_ID('ck_migtest_e_basic_status', 'C') IS NOT NULL) alter table migtest_e_basic drop constraint ck_migtest_e_basic_status;
|
||||
IF OBJECT_ID('ck_migtest_e_basic_status', 'C') IS NOT NULL alter table migtest_e_basic drop constraint ck_migtest_e_basic_status;
|
||||
EXEC usp_ebean_drop_default_constraint migtest_e_basic, status;
|
||||
alter table migtest_e_basic alter column status nvarchar(1);
|
||||
alter table migtest_e_basic add constraint ck_migtest_e_basic_status check ( status in ('N','A','I'));
|
||||
|
||||
update migtest_e_basic set status2 = 'N' where status2 is null;
|
||||
IF (OBJECT_ID('ck_migtest_e_basic_status2', 'C') IS NOT NULL) alter table migtest_e_basic drop constraint ck_migtest_e_basic_status2;
|
||||
alter table migtest_e_basic add default 'N' for status2;
|
||||
IF OBJECT_ID('ck_migtest_e_basic_status2', 'C') IS NOT NULL alter table migtest_e_basic drop constraint ck_migtest_e_basic_status2;
|
||||
EXEC usp_ebean_drop_default_constraint migtest_e_basic, status2;
|
||||
alter table migtest_e_basic alter column status2 nvarchar(1) not null;
|
||||
alter table migtest_e_basic add default 'N' for status2;
|
||||
alter table migtest_e_basic add constraint ck_migtest_e_basic_status2 check ( status2 in ('N','A','I'));
|
||||
IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_description') drop index uq_migtest_e_basic_description ON migtest_e_basic;
|
||||
IF (OBJECT_ID('uq_migtest_e_basic_description', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_description;
|
||||
IF OBJECT_ID('uq_migtest_e_basic_description', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_description;
|
||||
|
||||
update migtest_e_basic set user_id = 23 where user_id is null;
|
||||
IF OBJECT_ID('fk_migtest_e_basic_user_id', 'F') IS NOT NULL alter table migtest_e_basic drop constraint fk_migtest_e_basic_user_id;
|
||||
alter table migtest_e_basic add default 23 for user_id;
|
||||
EXEC usp_ebean_drop_default_constraint migtest_e_basic, user_id;
|
||||
alter table migtest_e_basic alter column user_id integer not null;
|
||||
alter table migtest_e_basic add default 23 for user_id;
|
||||
alter table migtest_e_basic add description_file image;
|
||||
alter table migtest_e_basic add old_boolean bit default 0 not null;
|
||||
alter table migtest_e_basic add old_boolean2 bit;
|
||||
alter table migtest_e_basic add eref_id integer;
|
||||
|
||||
IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_status_indextest1') drop index uq_migtest_e_basic_status_indextest1 ON migtest_e_basic;
|
||||
IF (OBJECT_ID('uq_migtest_e_basic_status_indextest1', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_status_indextest1;
|
||||
IF OBJECT_ID('uq_migtest_e_basic_status_indextest1', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_status_indextest1;
|
||||
IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_name') drop index uq_migtest_e_basic_name ON migtest_e_basic;
|
||||
IF (OBJECT_ID('uq_migtest_e_basic_name', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_name;
|
||||
IF OBJECT_ID('uq_migtest_e_basic_name', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_name;
|
||||
IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_indextest4') drop index uq_migtest_e_basic_indextest4 ON migtest_e_basic;
|
||||
IF (OBJECT_ID('uq_migtest_e_basic_indextest4', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest4;
|
||||
IF OBJECT_ID('uq_migtest_e_basic_indextest4', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest4;
|
||||
IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'uq_migtest_e_basic_indextest5') drop index uq_migtest_e_basic_indextest5 ON migtest_e_basic;
|
||||
IF (OBJECT_ID('uq_migtest_e_basic_indextest5', 'UQ') IS NOT NULL) alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest5;
|
||||
IF OBJECT_ID('uq_migtest_e_basic_indextest5', 'UQ') IS NOT NULL alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest5;
|
||||
create unique nonclustered index uq_migtest_e_basic_indextest2 on migtest_e_basic(indextest2) where indextest2 is not null;
|
||||
create unique nonclustered index uq_migtest_e_basic_indextest6 on migtest_e_basic(indextest6) where indextest6 is not null;
|
||||
IF (OBJECT_ID('ck_migtest_e_enum_test_status', 'C') IS NOT NULL) alter table migtest_e_enum drop constraint ck_migtest_e_enum_test_status;
|
||||
IF OBJECT_ID('ck_migtest_e_enum_test_status', 'C') IS NOT NULL alter table migtest_e_enum drop constraint ck_migtest_e_enum_test_status;
|
||||
alter table migtest_e_enum add constraint ck_migtest_e_enum_test_status check ( test_status in ('N','A','I'));
|
||||
EXEC usp_ebean_drop_default_constraint migtest_e_history2, test_string;
|
||||
alter table migtest_e_history2 alter column test_string nvarchar(255);
|
||||
@@ -60,8 +62,9 @@ alter table migtest_e_history6 alter column test_number1 integer;
|
||||
|
||||
-- NOTE: table has @History - special migration may be necessary
|
||||
update migtest_e_history6 set test_number2 = 7 where test_number2 is null;
|
||||
alter table migtest_e_history6 add default 7 for test_number2;
|
||||
EXEC usp_ebean_drop_default_constraint migtest_e_history6, test_number2;
|
||||
alter table migtest_e_history6 alter column test_number2 integer not null;
|
||||
alter table migtest_e_history6 add default 7 for test_number2;
|
||||
create index ix_migtest_e_basic_indextest1 on migtest_e_basic (indextest1);
|
||||
create index ix_migtest_e_basic_indextest5 on migtest_e_basic (indextest5);
|
||||
IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'ix_migtest_e_basic_indextest3') drop index ix_migtest_e_basic_indextest3 ON migtest_e_basic;
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
-2122378240, I__create_procs.sql
|
||||
-813787447, 1.0__initial.sql
|
||||
-898063858, 1.1.sql
|
||||
-925841767, 1.1.sql
|
||||
1019731053, 1.2__dropsFor_1.1.sql
|
||||
-494373130, 1.3.sql
|
||||
-1858208, 1.3.sql
|
||||
-1335541264, 1.4__dropsFor_1.3.sql
|
||||
1607822082, R__order_views_mssql.sql
|
||||
|
||||
Reference in new issue
Block a user