-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add failing test case for drop_column (#96)
* Add failing test case for rename_column * Improve rename_column SQLite behavior `ALTER TABLE .. RENAME COLUMN .. TO ..` is officially supported and does not need the temporary table workaround. * Add failing test case for drop_column * Preserve foreign keys in SQLite on drop_column Closes gobuffalo/pop#574 * Bump CockroachDB to non-EOL version CockroachDB v2.1 has reached EOL on 7/1/20. The next version v19.1 already reached maintenance support and will reach EOL in 11/1/20 which is why this was bumped to v19.2 right away. * Resolve missing keys and broken NULL constraints Resolves an issue where CockroachDB would be missing e.g. UNIQUE indices when using `change_column`. Also fixes a bug when using `change_column` with `NOT NUL` but without `DEFAULT`. * Add missing PostgreSQL E2E fixtures * Add missing MySQL E2E fixtures
- Loading branch information
Showing
82 changed files
with
1,649 additions
and
160 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
CREATE TABLE e2e_users ( | ||
id UUID NOT NULL, | ||
created_at TIMESTAMP NOT NULL, | ||
updated_at TIMESTAMP NOT NULL, | ||
CONSTRAINT "primary" PRIMARY KEY (id ASC), | ||
FAMILY "primary" (id, created_at, updated_at) | ||
); | ||
|
||
CREATE TABLE e2e_user_posts ( | ||
id UUID NOT NULL, | ||
user_id UUID NOT NULL, | ||
content VARCHAR(255) NOT NULL DEFAULT '':::STRING, | ||
slug VARCHAR(64) NOT NULL, | ||
CONSTRAINT "primary" PRIMARY KEY (id ASC), | ||
INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (user_id ASC), | ||
INDEX e2e_user_notes_user_id_idx (user_id ASC), | ||
UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), | ||
FAMILY "primary" (id, user_id, content, slug) | ||
); | ||
|
||
CREATE TABLE schema_migration ( | ||
version VARCHAR(14) NOT NULL, | ||
UNIQUE INDEX schema_migration_version_idx (version ASC), | ||
FAMILY "primary" (version, rowid) | ||
); | ||
|
||
ALTER TABLE e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES e2e_users(id) ON DELETE CASCADE; | ||
|
||
-- Validate foreign key constraints. These can fail if there was unvalidated data during the dump. | ||
ALTER TABLE e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; |
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
CREATE TABLE e2e_users ( | ||
id UUID NOT NULL, | ||
created_at TIMESTAMP NOT NULL, | ||
updated_at TIMESTAMP NOT NULL, | ||
username VARCHAR(255) NULL, | ||
CONSTRAINT "primary" PRIMARY KEY (id ASC), | ||
FAMILY "primary" (id, created_at, updated_at, username) | ||
); | ||
|
||
CREATE TABLE e2e_user_posts ( | ||
id UUID NOT NULL, | ||
user_id UUID NOT NULL, | ||
slug VARCHAR(64) NOT NULL, | ||
notes VARCHAR(255) NULL, | ||
CONSTRAINT "primary" PRIMARY KEY (id ASC), | ||
INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (user_id ASC), | ||
INDEX e2e_user_notes_user_id_idx (user_id ASC), | ||
UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), | ||
FAMILY "primary" (id, user_id, slug, notes) | ||
); | ||
|
||
CREATE TABLE schema_migration ( | ||
version VARCHAR(14) NOT NULL, | ||
UNIQUE INDEX schema_migration_version_idx (version ASC), | ||
FAMILY "primary" (version, rowid) | ||
); | ||
|
||
ALTER TABLE e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES e2e_users(id) ON DELETE CASCADE; | ||
|
||
-- Validate foreign key constraints. These can fail if there was unvalidated data during the dump. | ||
ALTER TABLE e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
CREATE TABLE e2e_users ( | ||
id UUID NOT NULL, | ||
created_at TIMESTAMP NOT NULL, | ||
updated_at TIMESTAMP NOT NULL, | ||
username VARCHAR(255) NULL, | ||
CONSTRAINT "primary" PRIMARY KEY (id ASC), | ||
FAMILY "primary" (id, created_at, updated_at, username) | ||
); | ||
|
||
CREATE TABLE e2e_user_posts ( | ||
id UUID NOT NULL, | ||
user_id UUID NOT NULL, | ||
content VARCHAR(255) NOT NULL DEFAULT '':::STRING, | ||
slug VARCHAR(64) NOT NULL, | ||
CONSTRAINT "primary" PRIMARY KEY (id ASC), | ||
INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (user_id ASC), | ||
INDEX e2e_user_notes_user_id_idx (user_id ASC), | ||
UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), | ||
FAMILY "primary" (id, user_id, content, slug) | ||
); | ||
|
||
CREATE TABLE schema_migration ( | ||
version VARCHAR(14) NOT NULL, | ||
UNIQUE INDEX schema_migration_version_idx (version ASC), | ||
FAMILY "primary" (version, rowid) | ||
); | ||
|
||
ALTER TABLE e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES e2e_users(id) ON DELETE CASCADE; | ||
|
||
-- Validate foreign key constraints. These can fail if there was unvalidated data during the dump. | ||
ALTER TABLE e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
CREATE TABLE e2e_users ( | ||
id UUID NOT NULL, | ||
created_at TIMESTAMP NOT NULL, | ||
updated_at TIMESTAMP NOT NULL, | ||
name VARCHAR(255) NULL, | ||
CONSTRAINT "primary" PRIMARY KEY (id ASC), | ||
FAMILY "primary" (id, created_at, updated_at, name) | ||
); | ||
|
||
CREATE TABLE e2e_user_posts ( | ||
id UUID NOT NULL, | ||
user_id UUID NOT NULL, | ||
content VARCHAR(255) NOT NULL DEFAULT '':::STRING, | ||
slug VARCHAR(64) NOT NULL, | ||
CONSTRAINT "primary" PRIMARY KEY (id ASC), | ||
INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (user_id ASC), | ||
INDEX e2e_user_notes_user_id_idx (user_id ASC), | ||
UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), | ||
FAMILY "primary" (id, user_id, content, slug) | ||
); | ||
|
||
CREATE TABLE schema_migration ( | ||
version VARCHAR(14) NOT NULL, | ||
UNIQUE INDEX schema_migration_version_idx (version ASC), | ||
FAMILY "primary" (version, rowid) | ||
); | ||
|
||
ALTER TABLE e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES e2e_users(id) ON DELETE CASCADE; | ||
|
||
-- Validate foreign key constraints. These can fail if there was unvalidated data during the dump. | ||
ALTER TABLE e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
CREATE TABLE e2e_users ( | ||
id UUID NOT NULL, | ||
created_at TIMESTAMP NOT NULL, | ||
updated_at TIMESTAMP NOT NULL, | ||
CONSTRAINT "primary" PRIMARY KEY (id ASC), | ||
FAMILY "primary" (id, created_at, updated_at) | ||
); | ||
|
||
CREATE TABLE e2e_user_posts ( | ||
id UUID NOT NULL, | ||
user_id UUID NOT NULL, | ||
content VARCHAR(255) NOT NULL DEFAULT '':::STRING, | ||
slug VARCHAR(32) NOT NULL, | ||
CONSTRAINT "primary" PRIMARY KEY (id ASC), | ||
INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (user_id ASC), | ||
INDEX e2e_user_notes_user_id_idx (user_id ASC), | ||
UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), | ||
FAMILY "primary" (id, user_id, content, slug) | ||
); | ||
|
||
CREATE TABLE schema_migration ( | ||
version VARCHAR(14) NOT NULL, | ||
UNIQUE INDEX schema_migration_version_idx (version ASC), | ||
FAMILY "primary" (version, rowid) | ||
); | ||
|
||
ALTER TABLE e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES e2e_users(id) ON DELETE CASCADE; | ||
|
||
-- Validate foreign key constraints. These can fail if there was unvalidated data during the dump. | ||
ALTER TABLE e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; |
Oops, something went wrong.