Skip to content

Commit

Permalink
Add failing test case for drop_column
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Jul 6, 2020
1 parent 90e8603 commit 18bd9e5
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 21 deletions.
68 changes: 68 additions & 0 deletions go.sum

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions internal/e2e/fixtures/sqlite3/down/1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ CREATE TABLE IF NOT EXISTS "schema_migration" (
CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version);
CREATE TABLE IF NOT EXISTS "e2e_users" (
"id" TEXT PRIMARY KEY,
"username" TEXT,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
);
, "username" TEXT);
3 changes: 1 addition & 2 deletions internal/e2e/fixtures/sqlite3/down/2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ CREATE TABLE IF NOT EXISTS "schema_migration" (
CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version);
CREATE TABLE IF NOT EXISTS "e2e_users" (
"id" TEXT PRIMARY KEY,
"username" TEXT,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
);
, "username" TEXT);
CREATE TABLE IF NOT EXISTS "e2e_user_notes" (
"id" TEXT PRIMARY KEY,
"user_id" char(36) NOT NULL,
Expand Down
3 changes: 1 addition & 2 deletions internal/e2e/fixtures/sqlite3/down/3.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ CREATE TABLE IF NOT EXISTS "schema_migration" (
CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version);
CREATE TABLE IF NOT EXISTS "e2e_users" (
"id" TEXT PRIMARY KEY,
"username" TEXT,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
);
, "username" TEXT);
CREATE TABLE IF NOT EXISTS "e2e_user_notes" (
"id" TEXT PRIMARY KEY,
"user_id" char(36) NOT NULL,
Expand Down
3 changes: 1 addition & 2 deletions internal/e2e/fixtures/sqlite3/down/4.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ CREATE TABLE IF NOT EXISTS "schema_migration" (
CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version);
CREATE TABLE IF NOT EXISTS "e2e_users" (
"id" TEXT PRIMARY KEY,
"username" TEXT,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
);
, "username" TEXT);
CREATE TABLE IF NOT EXISTS "e2e_user_notes" (
"id" TEXT PRIMARY KEY,
"user_id" char(36) NOT NULL,
Expand Down
3 changes: 1 addition & 2 deletions internal/e2e/fixtures/sqlite3/down/5.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ CREATE TABLE IF NOT EXISTS "schema_migration" (
CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version);
CREATE TABLE IF NOT EXISTS "e2e_users" (
"id" TEXT PRIMARY KEY,
"username" TEXT,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
);
, "username" TEXT);
CREATE TABLE IF NOT EXISTS "e2e_user_notes" (
"id" TEXT PRIMARY KEY,
"user_id" char(36) NOT NULL,
Expand Down
3 changes: 1 addition & 2 deletions internal/e2e/fixtures/sqlite3/down/6.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ CREATE TABLE IF NOT EXISTS "schema_migration" (
CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version);
CREATE TABLE IF NOT EXISTS "e2e_users" (
"id" TEXT PRIMARY KEY,
"username" TEXT,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
);
, "username" TEXT);
CREATE TABLE IF NOT EXISTS "e2e_user_notes" (
"id" TEXT PRIMARY KEY,
"user_id" char(36) NOT NULL,
Expand Down
3 changes: 1 addition & 2 deletions internal/e2e/fixtures/sqlite3/down/7.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ CREATE TABLE IF NOT EXISTS "schema_migration" (
CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version);
CREATE TABLE IF NOT EXISTS "e2e_users" (
"id" TEXT PRIMARY KEY,
"username" TEXT,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
);
, "username" TEXT);
CREATE TABLE IF NOT EXISTS "e2e_user_posts" (
"id" TEXT PRIMARY KEY,
"user_id" char(36) NOT NULL,
Expand Down
13 changes: 6 additions & 7 deletions internal/e2e/fixtures/sqlite3/down/8.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ CREATE TABLE IF NOT EXISTS "schema_migration" (
"version" TEXT NOT NULL
);
CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version);
CREATE TABLE IF NOT EXISTS "e2e_users" (
"id" TEXT PRIMARY KEY,
"username" TEXT,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
);
CREATE TABLE IF NOT EXISTS "e2e_user_posts" (
"id" TEXT PRIMARY KEY,
"user_id" char(36) NOT NULL,
"slug" TEXT NOT NULL,
"content" TEXT NOT NULL DEFAULT '',
FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE
FOREIGN KEY (user_id) REFERENCES "_e2e_users_tmp" (id) ON UPDATE NO ACTION ON DELETE CASCADE
);
CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug);
CREATE TABLE IF NOT EXISTS "e2e_users" (
"id" TEXT PRIMARY KEY,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
, "username" TEXT);
17 changes: 17 additions & 0 deletions internal/e2e/fixtures/sqlite3/down/9.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CREATE TABLE IF NOT EXISTS "schema_migration" (
"version" TEXT NOT NULL
);
CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version);
CREATE TABLE IF NOT EXISTS "e2e_user_posts" (
"id" TEXT PRIMARY KEY,
"user_id" char(36) NOT NULL,
"slug" TEXT NOT NULL,
"content" TEXT NOT NULL DEFAULT '',
FOREIGN KEY (user_id) REFERENCES "_e2e_users_tmp" (id) ON UPDATE NO ACTION ON DELETE CASCADE
);
CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug);
CREATE TABLE IF NOT EXISTS "e2e_users" (
"id" TEXT PRIMARY KEY,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
, "name" TEXT);
17 changes: 17 additions & 0 deletions internal/e2e/fixtures/sqlite3/up/9.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CREATE TABLE IF NOT EXISTS "schema_migration" (
"version" TEXT NOT NULL
);
CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version);
CREATE TABLE IF NOT EXISTS "e2e_user_posts" (
"id" TEXT PRIMARY KEY,
"user_id" char(36) NOT NULL,
"slug" TEXT NOT NULL,
"content" TEXT NOT NULL DEFAULT '',
FOREIGN KEY (user_id) REFERENCES "_e2e_users_tmp" (id) ON UPDATE NO ACTION ON DELETE CASCADE
);
CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug);
CREATE TABLE IF NOT EXISTS "e2e_users" (
"id" TEXT PRIMARY KEY,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_column("e2e_users", "name", "string", {"null": true})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
drop_column("e2e_users", "name")

0 comments on commit 18bd9e5

Please sign in to comment.