-
-
Notifications
You must be signed in to change notification settings - Fork 959
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
196 additions
and
59 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
Empty file.
Empty file.
Empty file.
1 change: 1 addition & 0 deletions
1
persistence/sql/migrations/sql/20200812124254_add_session_token.cockroach.down.sql
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 @@ | ||
ALTER TABLE "sessions" DROP COLUMN "token";COMMIT TRANSACTION;BEGIN TRANSACTION; |
8 changes: 8 additions & 0 deletions
8
persistence/sql/migrations/sql/20200812124254_add_session_token.cockroach.up.sql
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,8 @@ | ||
DELETE FROM sessions; | ||
ALTER TABLE "sessions" ADD COLUMN "token" VARCHAR (32);COMMIT TRANSACTION;BEGIN TRANSACTION; | ||
ALTER TABLE "sessions" RENAME COLUMN "token" TO "_token_tmp";COMMIT TRANSACTION;BEGIN TRANSACTION; | ||
ALTER TABLE "sessions" ADD COLUMN "token" VARCHAR (32);COMMIT TRANSACTION;BEGIN TRANSACTION; | ||
UPDATE "sessions" SET "token" = "_token_tmp";COMMIT TRANSACTION;BEGIN TRANSACTION; | ||
ALTER TABLE "sessions" DROP COLUMN "_token_tmp";COMMIT TRANSACTION;BEGIN TRANSACTION; | ||
CREATE UNIQUE INDEX "sessions_token_uq_idx" ON "sessions" (token);COMMIT TRANSACTION;BEGIN TRANSACTION; | ||
CREATE INDEX "sessions_token_idx" ON "sessions" (token);COMMIT TRANSACTION;BEGIN TRANSACTION; |
1 change: 1 addition & 0 deletions
1
persistence/sql/migrations/sql/20200812124254_add_session_token.mysql.down.sql
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 @@ | ||
ALTER TABLE `sessions` DROP COLUMN `token`; |
5 changes: 5 additions & 0 deletions
5
persistence/sql/migrations/sql/20200812124254_add_session_token.mysql.up.sql
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,5 @@ | ||
DELETE FROM sessions; | ||
ALTER TABLE `sessions` ADD COLUMN `token` VARCHAR (32); | ||
ALTER TABLE `sessions` MODIFY `token` VARCHAR (32); | ||
CREATE UNIQUE INDEX `sessions_token_uq_idx` ON `sessions` (`token`); | ||
CREATE INDEX `sessions_token_idx` ON `sessions` (`token`); |
1 change: 1 addition & 0 deletions
1
persistence/sql/migrations/sql/20200812124254_add_session_token.postgres.down.sql
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 @@ | ||
ALTER TABLE "sessions" DROP COLUMN "token"; |
5 changes: 5 additions & 0 deletions
5
persistence/sql/migrations/sql/20200812124254_add_session_token.postgres.up.sql
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,5 @@ | ||
DELETE FROM sessions; | ||
ALTER TABLE "sessions" ADD COLUMN "token" VARCHAR (32); | ||
ALTER TABLE "sessions" ALTER COLUMN "token" TYPE VARCHAR (32), ALTER COLUMN "token" DROP NOT NULL; | ||
CREATE UNIQUE INDEX "sessions_token_uq_idx" ON "sessions" (token); | ||
CREATE INDEX "sessions_token_idx" ON "sessions" (token); |
15 changes: 15 additions & 0 deletions
15
persistence/sql/migrations/sql/20200812124254_add_session_token.sqlite3.down.sql
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,15 @@ | ||
DROP INDEX IF EXISTS "sessions_token_idx"; | ||
DROP INDEX IF EXISTS "sessions_token_uq_idx"; | ||
ALTER TABLE "sessions" RENAME TO "_sessions_tmp"; | ||
CREATE TABLE "sessions" ( | ||
"id" TEXT PRIMARY KEY, | ||
"issued_at" DATETIME NOT NULL DEFAULT 'CURRENT_TIMESTAMP', | ||
"expires_at" DATETIME NOT NULL, | ||
"authenticated_at" DATETIME NOT NULL, | ||
"identity_id" char(36) NOT NULL, | ||
"created_at" DATETIME NOT NULL, | ||
"updated_at" DATETIME NOT NULL, | ||
FOREIGN KEY (identity_id) REFERENCES identities (id) ON UPDATE NO ACTION ON DELETE CASCADE | ||
); | ||
INSERT INTO "sessions" (id, issued_at, expires_at, authenticated_at, identity_id, created_at, updated_at) SELECT id, issued_at, expires_at, authenticated_at, identity_id, created_at, updated_at FROM "_sessions_tmp"; | ||
DROP TABLE "_sessions_tmp"; |
18 changes: 18 additions & 0 deletions
18
persistence/sql/migrations/sql/20200812124254_add_session_token.sqlite3.up.sql
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,18 @@ | ||
DELETE FROM sessions; | ||
ALTER TABLE "sessions" ADD COLUMN "token" TEXT; | ||
ALTER TABLE "sessions" RENAME TO "_sessions_tmp"; | ||
CREATE TABLE "sessions" ( | ||
"id" TEXT PRIMARY KEY, | ||
"issued_at" DATETIME NOT NULL DEFAULT 'CURRENT_TIMESTAMP', | ||
"expires_at" DATETIME NOT NULL, | ||
"authenticated_at" DATETIME NOT NULL, | ||
"identity_id" char(36) NOT NULL, | ||
"created_at" DATETIME NOT NULL, | ||
"updated_at" DATETIME NOT NULL, | ||
"token" TEXT, | ||
FOREIGN KEY (identity_id) REFERENCES identities (id) ON UPDATE NO ACTION ON DELETE CASCADE | ||
); | ||
INSERT INTO "sessions" (id, issued_at, expires_at, authenticated_at, identity_id, created_at, updated_at, token) SELECT id, issued_at, expires_at, authenticated_at, identity_id, created_at, updated_at, token FROM "_sessions_tmp"; | ||
DROP TABLE "_sessions_tmp"; | ||
CREATE UNIQUE INDEX "sessions_token_uq_idx" ON "sessions" (token); | ||
CREATE INDEX "sessions_token_idx" ON "sessions" (token); |
1 change: 1 addition & 0 deletions
1
persistence/sql/migrations/templates/20200812124254_add_session_token.down.fizz
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 @@ | ||
drop_column("sessions", "token") |
7 changes: 7 additions & 0 deletions
7
persistence/sql/migrations/templates/20200812124254_add_session_token.up.fizz
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,7 @@ | ||
sql("DELETE FROM sessions;") | ||
|
||
add_column("sessions", "token", "string", {"size": 32, "null": true}) | ||
change_column("sessions", "token", "string", {"size": 32, "null": false}) | ||
|
||
add_index("sessions", "token", {"unique": true, "name": "sessions_token_uq_idx"}) | ||
add_index("sessions", "token", {"name": "sessions_token_idx" }) |
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
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
Oops, something went wrong.