...

Text file src/github.com/ory/x/popx/stub/migrations/legacy/20200812124254_add_session_token.sqlite3.up.sql

Documentation: github.com/ory/x/popx/stub/migrations/legacy

     1DELETE FROM sessions;
     2ALTER TABLE "sessions" ADD COLUMN "token" TEXT;
     3CREATE TABLE "_sessions_tmp" (
     4"id" TEXT PRIMARY KEY,
     5"issued_at" DATETIME NOT NULL DEFAULT 'CURRENT_TIMESTAMP',
     6"expires_at" DATETIME NOT NULL,
     7"authenticated_at" DATETIME NOT NULL,
     8"identity_id" char(36) NOT NULL,
     9"created_at" DATETIME NOT NULL,
    10"updated_at" DATETIME NOT NULL,
    11"token" TEXT,
    12FOREIGN KEY (identity_id) REFERENCES identities (id) ON UPDATE NO ACTION ON DELETE CASCADE
    13);
    14INSERT INTO "_sessions_tmp" (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";
    15DROP TABLE "sessions";
    16ALTER TABLE "_sessions_tmp" RENAME TO "sessions";
    17CREATE UNIQUE INDEX "sessions_token_uq_idx" ON "sessions" (token);
    18CREATE INDEX "sessions_token_idx" ON "sessions" (token);

View as plain text