snapshot of https://github.com/ory/kratos.git (master, 2026-09-15; blobs > 131072B omitted)
Some checks failed
CI / Run tests and lints (push) Failing after 29s
CI / Build CLI docs (push) Has been skipped
CI / Run Playwright end-to-end tests (mysql) (push) Failing after 3s
CI / Run Playwright end-to-end tests (postgres) (push) Failing after 2s
CI / Run Playwright end-to-end tests (sqlite) (push) Failing after 3s
CodeQL / Analyze (go) (push) Failing after 4s
CodeQL / Analyze (javascript) (push) Failing after 3s
Docker Image Scanners / scanners (push) Failing after 4s
Synchronize Issue Labels / Synchronize Issue Labels (push) Has been skipped
CI / Run end-to-end tests (postgres) (push) Failing after 19s
CI / Run end-to-end tests (sqlite) (push) Failing after 2s
CI / Run Playwright end-to-end tests (cockroach) (push) Failing after 2s
CI / Draft newsletter (push) Has been skipped
CI / Generate release (push) Has been skipped
CI / Pending approval Slack notification (push) Has been skipped
CI / Send newsletter (push) Has been skipped

This commit is contained in:
upstream-mirror
2026-09-15 21:19:12 +05:00
commit c60cc7ca75
8092 changed files with 394160 additions and 0 deletions

View File

@@ -0,0 +1,289 @@
// Copyright © 2025 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package gomigrations
import (
"fmt"
"github.com/pkg/errors"
"github.com/ory/pop/v6"
"github.com/ory/x/popx"
)
var backfillIdentityID = []popx.Migration{
{
Version: "20251105000000000001",
Path: path(),
Name: "Backfill column identity_id in identity_credential_identifiers",
Direction: "up",
Type: "go",
DBType: "cockroach",
Autocommit: true,
Runner: func(m popx.Migration, c *pop.Connection) error {
_, err := c.Store.Exec("CREATE INDEX IF NOT EXISTS ici_identity_id_backfill_storing ON identity_credential_identifiers (identity_id ASC) STORING (identity_credential_id) NOT VISIBLE")
if err != nil {
return errors.WithStack(err)
}
for {
res, err := c.Store.Exec(`
UPDATE
identity_credential_identifiers@ici_identity_id_backfill_storing ici
SET
identity_id = ic.identity_id
FROM
identity_credentials ic
WHERE
ici.identity_credential_id = ic.id
-- AND ici.nid = ic.nid -- not needed because JOIN predicate is on primary key
AND ici.identity_id IS NULL
LIMIT 10000`)
if err != nil {
return errors.WithStack(err)
}
n, err := res.RowsAffected()
if err != nil {
return errors.WithStack(err)
}
if n == 0 {
break
}
fmt.Printf("Backfilled column identity_id for %d rows in identity_credential_identifiers table\n", n)
}
_, err = c.Store.Exec("DROP INDEX identity_credential_identifiers@ici_identity_id_backfill_storing")
return errors.WithStack(err)
},
},
{
Version: "20251105000000000001",
Path: path(),
Name: "Backfill column identity_id in identity_credential_identifiers",
Direction: "up",
Type: "go",
DBType: "postgres",
Autocommit: true,
Runner: func(m popx.Migration, c *pop.Connection) error {
for {
res, err := c.Store.Exec(`
WITH to_update AS (
SELECT ici.id, ic.identity_id
FROM identity_credential_identifiers ici
JOIN identity_credentials ic ON ici.identity_credential_id = ic.id AND ici.nid = ic.nid
WHERE ici.identity_id IS NULL
LIMIT 10000
)
UPDATE identity_credential_identifiers ici
SET identity_id = to_update.identity_id
FROM to_update
WHERE ici.id = to_update.id`)
if err != nil {
return errors.WithStack(err)
}
n, err := res.RowsAffected()
if err != nil {
return errors.WithStack(err)
}
if n == 0 {
break
}
fmt.Printf("Backfilled column identity_id for %d rows in identity_credential_identifiers table\n", n)
}
return nil
},
},
{
Version: "20251105000000000001",
Path: path(),
Name: "Backfill column identity_id in identity_credential_identifiers",
Direction: "up",
Type: "go",
DBType: "mysql",
Autocommit: true,
Runner: func(m popx.Migration, c *pop.Connection) error {
for {
res, err := c.Store.Exec(`
UPDATE identity_credential_identifiers ici
JOIN (
SELECT ici2.id
FROM identity_credential_identifiers ici2
JOIN identity_credentials ic ON ici2.identity_credential_id = ic.id AND ici2.nid = ic.nid
WHERE ici2.identity_id IS NULL
LIMIT 10000
) t ON ici.id = t.id
JOIN identity_credentials ic ON ici.identity_credential_id = ic.id
SET ici.identity_id = ic.identity_id`)
if err != nil {
return errors.WithStack(err)
}
n, err := res.RowsAffected()
if err != nil {
return errors.WithStack(err)
}
if n == 0 {
break
}
fmt.Printf("Backfilled column identity_id for %d rows in identity_credential_identifiers table\n", n)
}
return nil
},
},
{
Version: "20251105000000000001",
Path: path(),
Name: "Backfill column identity_id in identity_credential_identifiers (noop)",
Direction: "up",
Type: "go",
DBType: "sqlite3",
Autocommit: false,
Runner: func(m popx.Migration, c *pop.Connection) error {
return nil // nothing, see 20251104000000000000_identifiers_devices_identity_id.sqlite.up.sql
},
},
{
Version: "20251105000000000001",
Path: path(),
Name: "Revert backfill column identity_id in identity_credential_identifiers (noop)",
Direction: "down",
Type: "go",
DBType: "all",
Runner: func(m popx.Migration, c *pop.Connection) error {
return nil
},
},
{
Version: "20251105000000000002",
Path: path(),
Name: "Backfill column identity_id in session_devices",
Direction: "up",
Type: "go",
DBType: "cockroach",
Autocommit: true,
Runner: func(m popx.Migration, c *pop.Connection) error {
for {
res, err := c.Store.Exec(`
UPDATE
session_devices sd
SET
identity_id = s.identity_id
FROM
sessions s
WHERE
sd.session_id = s.id
AND sd.nid = s.nid
AND sd.identity_id IS NULL
LIMIT 10000`)
if err != nil {
return errors.WithStack(err)
}
n, err := res.RowsAffected()
if err != nil {
return errors.WithStack(err)
}
if n == 0 {
break
}
fmt.Printf("Backfilled column identity_id for %d rows in session_devices table\n", n)
}
return nil
},
},
{
Version: "20251105000000000002",
Path: path(),
Name: "Backfill column identity_id in session_devices",
Direction: "up",
Type: "go",
DBType: "postgres",
Autocommit: true,
Runner: func(m popx.Migration, c *pop.Connection) error {
for {
res, err := c.Store.Exec(`
WITH to_update AS (
SELECT sd.id, s.identity_id
FROM session_devices sd
JOIN sessions s ON sd.session_id = s.id AND sd.nid = s.nid
WHERE sd.identity_id IS NULL
LIMIT 10000
)
UPDATE session_devices sd
SET identity_id = to_update.identity_id
FROM to_update
WHERE sd.id = to_update.id`)
if err != nil {
return errors.WithStack(err)
}
n, err := res.RowsAffected()
if err != nil {
return errors.WithStack(err)
}
if n == 0 {
break
}
fmt.Printf("Backfilled column identity_id for %d rows in session_devices table\n", n)
}
return nil
},
},
{
Version: "20251105000000000002",
Path: path(),
Name: "Backfill column identity_id in session_devices",
Direction: "up",
Type: "go",
DBType: "mysql",
Autocommit: true,
Runner: func(m popx.Migration, c *pop.Connection) error {
for {
res, err := c.Store.Exec(`
UPDATE session_devices sd
JOIN (
SELECT sd2.id
FROM session_devices sd2
JOIN sessions s2 ON sd2.session_id = s2.id AND sd2.nid = s2.nid
WHERE sd2.identity_id IS NULL
LIMIT 10000
) t ON sd.id = t.id
JOIN sessions s ON sd.session_id = s.id
SET sd.identity_id = s.identity_id`)
if err != nil {
return errors.WithStack(err)
}
n, err := res.RowsAffected()
if err != nil {
return errors.WithStack(err)
}
if n == 0 {
break
}
fmt.Printf("Backfilled column identity_id for %d rows in session_devices table\n", n)
}
return nil
},
},
{
Version: "20251105000000000002",
Path: path(),
Name: "Backfill column identity_id in session_devices (noop)",
Direction: "up",
Type: "go",
DBType: "sqlite3",
Autocommit: false,
Runner: func(m popx.Migration, c *pop.Connection) error {
return nil // nothing, see 20251104000000000000_identifiers_devices_identity_id.sqlite.up.sql
},
},
{
Version: "20251105000000000002",
Path: path(),
Name: "Revert backfill column identity_id in session_devices (noop)",
Direction: "down",
Type: "go",
DBType: "all",
Autocommit: false,
Runner: func(m popx.Migration, c *pop.Connection) error {
return nil
},
},
}

View File

@@ -0,0 +1,26 @@
// Copyright © 2025 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package gomigrations
import (
"embed"
"fmt"
"path/filepath"
"runtime"
"slices"
)
var (
All = slices.Concat(
backfillIdentityID,
)
//go:embed *.go
Src embed.FS
)
func path() string {
_, file, line, _ := runtime.Caller(1)
return fmt.Sprintf("%s:%d", filepath.Base(file), line)
}

View File

@@ -0,0 +1,4 @@
DROP TABLE "identity_credential_identifiers";COMMIT TRANSACTION;BEGIN TRANSACTION;
DROP TABLE "identity_credentials";COMMIT TRANSACTION;BEGIN TRANSACTION;
DROP TABLE "identity_credential_types";COMMIT TRANSACTION;BEGIN TRANSACTION;
DROP TABLE "identities";COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1,35 @@
CREATE TABLE "identities" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"traits_schema_id" VARCHAR (2048) NOT NULL,
"traits" json NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);COMMIT TRANSACTION;BEGIN TRANSACTION;
CREATE TABLE "identity_credential_types" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"name" VARCHAR (32) NOT NULL
);COMMIT TRANSACTION;BEGIN TRANSACTION;
CREATE UNIQUE INDEX "identity_credential_types_name_idx" ON "identity_credential_types" (name);COMMIT TRANSACTION;BEGIN TRANSACTION;
CREATE TABLE "identity_credentials" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"config" json NOT NULL,
"identity_credential_type_id" UUID NOT NULL,
"identity_id" UUID NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
CONSTRAINT "identity_credentials_identities_id_fk" FOREIGN KEY ("identity_id") REFERENCES "identities" ("id") ON DELETE cascade,
CONSTRAINT "identity_credentials_identity_credential_types_id_fk" FOREIGN KEY ("identity_credential_type_id") REFERENCES "identity_credential_types" ("id") ON DELETE cascade
);COMMIT TRANSACTION;BEGIN TRANSACTION;
CREATE TABLE "identity_credential_identifiers" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"identifier" VARCHAR (255) NOT NULL,
"identity_credential_id" UUID NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
CONSTRAINT "identity_credential_identifiers_identity_credentials_id_fk" FOREIGN KEY ("identity_credential_id") REFERENCES "identity_credentials" ("id") ON DELETE cascade
);COMMIT TRANSACTION;BEGIN TRANSACTION;
CREATE UNIQUE INDEX "identity_credential_identifiers_identifier_idx" ON "identity_credential_identifiers" (identifier);COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1,4 @@
DROP TABLE `identity_credential_identifiers`;
DROP TABLE `identity_credentials`;
DROP TABLE `identity_credential_types`;
DROP TABLE `identities`;

View File

@@ -0,0 +1,35 @@
CREATE TABLE `identities` (
`id` char(36) NOT NULL,
PRIMARY KEY(`id`),
`traits_schema_id` VARCHAR (2048) NOT NULL,
`traits` JSON NOT NULL,
`created_at` DATETIME NOT NULL,
`updated_at` DATETIME NOT NULL
) ENGINE=InnoDB;
CREATE TABLE `identity_credential_types` (
`id` char(36) NOT NULL,
PRIMARY KEY(`id`),
`name` VARCHAR (32) NOT NULL
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `identity_credential_types_name_idx` ON `identity_credential_types` (`name`);
CREATE TABLE `identity_credentials` (
`id` char(36) NOT NULL,
PRIMARY KEY(`id`),
`config` JSON NOT NULL,
`identity_credential_type_id` char(36) 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 DELETE cascade,
FOREIGN KEY (`identity_credential_type_id`) REFERENCES `identity_credential_types` (`id`) ON DELETE cascade
) ENGINE=InnoDB;
CREATE TABLE `identity_credential_identifiers` (
`id` char(36) NOT NULL,
PRIMARY KEY(`id`),
`identifier` VARCHAR (255) NOT NULL,
`identity_credential_id` char(36) NOT NULL,
`created_at` DATETIME NOT NULL,
`updated_at` DATETIME NOT NULL,
FOREIGN KEY (`identity_credential_id`) REFERENCES `identity_credentials` (`id`) ON DELETE cascade
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `identity_credential_identifiers_identifier_idx` ON `identity_credential_identifiers` (`identifier`);

View File

@@ -0,0 +1,4 @@
DROP TABLE "identity_credential_identifiers";
DROP TABLE "identity_credentials";
DROP TABLE "identity_credential_types";
DROP TABLE "identities";

View File

@@ -0,0 +1,35 @@
CREATE TABLE "identities" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"traits_schema_id" VARCHAR (2048) NOT NULL,
"traits" jsonb NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);
CREATE TABLE "identity_credential_types" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"name" VARCHAR (32) NOT NULL
);
CREATE UNIQUE INDEX "identity_credential_types_name_idx" ON "identity_credential_types" (name);
CREATE TABLE "identity_credentials" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"config" jsonb NOT NULL,
"identity_credential_type_id" UUID NOT NULL,
"identity_id" UUID NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
FOREIGN KEY ("identity_id") REFERENCES "identities" ("id") ON DELETE cascade,
FOREIGN KEY ("identity_credential_type_id") REFERENCES "identity_credential_types" ("id") ON DELETE cascade
);
CREATE TABLE "identity_credential_identifiers" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"identifier" VARCHAR (255) NOT NULL,
"identity_credential_id" UUID NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
FOREIGN KEY ("identity_credential_id") REFERENCES "identity_credentials" ("id") ON DELETE cascade
);
CREATE UNIQUE INDEX "identity_credential_identifiers_identifier_idx" ON "identity_credential_identifiers" (identifier);

View File

@@ -0,0 +1,4 @@
DROP TABLE "identity_credential_identifiers";
DROP TABLE "identity_credentials";
DROP TABLE "identity_credential_types";
DROP TABLE "identities";

View File

@@ -0,0 +1,31 @@
CREATE TABLE "identities" (
"id" TEXT PRIMARY KEY,
"traits_schema_id" TEXT NOT NULL,
"traits" TEXT NOT NULL,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
);
CREATE TABLE "identity_credential_types" (
"id" TEXT PRIMARY KEY,
"name" TEXT NOT NULL
);
CREATE UNIQUE INDEX "identity_credential_types_name_idx" ON "identity_credential_types" (name);
CREATE TABLE "identity_credentials" (
"id" TEXT PRIMARY KEY,
"config" TEXT NOT NULL,
"identity_credential_type_id" char(36) 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 DELETE cascade,
FOREIGN KEY (identity_credential_type_id) REFERENCES identity_credential_types (id) ON DELETE cascade
);
CREATE TABLE "identity_credential_identifiers" (
"id" TEXT PRIMARY KEY,
"identifier" TEXT NOT NULL,
"identity_credential_id" char(36) NOT NULL,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL,
FOREIGN KEY (identity_credential_id) REFERENCES identity_credentials (id) ON DELETE cascade
);
CREATE UNIQUE INDEX "identity_credential_identifiers_identifier_idx" ON "identity_credential_identifiers" (identifier);

View File

@@ -0,0 +1,5 @@
DROP TABLE "selfservice_login_request_methods";COMMIT TRANSACTION;BEGIN TRANSACTION;
DROP TABLE "selfservice_login_requests";COMMIT TRANSACTION;BEGIN TRANSACTION;
DROP TABLE "selfservice_registration_request_methods";COMMIT TRANSACTION;BEGIN TRANSACTION;
DROP TABLE "selfservice_registration_requests";COMMIT TRANSACTION;BEGIN TRANSACTION;
DROP TABLE "selfservice_profile_management_requests";COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1,55 @@
CREATE TABLE "selfservice_login_requests" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"request_url" VARCHAR (2048) NOT NULL,
"issued_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"expires_at" timestamp NOT NULL,
"active_method" VARCHAR (32) NOT NULL,
"csrf_token" VARCHAR (255) NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);COMMIT TRANSACTION;BEGIN TRANSACTION;
CREATE TABLE "selfservice_login_request_methods" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"method" VARCHAR (32) NOT NULL,
"selfservice_login_request_id" UUID NOT NULL,
"config" json NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
CONSTRAINT "selfservice_login_request_methods_selfservice_login_requests_id_fk" FOREIGN KEY ("selfservice_login_request_id") REFERENCES "selfservice_login_requests" ("id") ON DELETE cascade
);COMMIT TRANSACTION;BEGIN TRANSACTION;
CREATE TABLE "selfservice_registration_requests" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"request_url" VARCHAR (2048) NOT NULL,
"issued_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"expires_at" timestamp NOT NULL,
"active_method" VARCHAR (32) NOT NULL,
"csrf_token" VARCHAR (255) NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);COMMIT TRANSACTION;BEGIN TRANSACTION;
CREATE TABLE "selfservice_registration_request_methods" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"method" VARCHAR (32) NOT NULL,
"selfservice_registration_request_id" UUID NOT NULL,
"config" json NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
CONSTRAINT "selfservice_registration_request_methods_selfservice_registration_requests_id_fk" FOREIGN KEY ("selfservice_registration_request_id") REFERENCES "selfservice_registration_requests" ("id") ON DELETE cascade
);COMMIT TRANSACTION;BEGIN TRANSACTION;
CREATE TABLE "selfservice_profile_management_requests" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"request_url" VARCHAR (2048) NOT NULL,
"issued_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"expires_at" timestamp NOT NULL,
"form" json NOT NULL,
"update_successful" bool NOT NULL,
"identity_id" UUID NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
CONSTRAINT "selfservice_profile_management_requests_identities_id_fk" FOREIGN KEY ("identity_id") REFERENCES "identities" ("id") ON DELETE cascade
);COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1,5 @@
DROP TABLE `selfservice_login_request_methods`;
DROP TABLE `selfservice_login_requests`;
DROP TABLE `selfservice_registration_request_methods`;
DROP TABLE `selfservice_registration_requests`;
DROP TABLE `selfservice_profile_management_requests`;

View File

@@ -0,0 +1,55 @@
CREATE TABLE `selfservice_login_requests` (
`id` char(36) NOT NULL,
PRIMARY KEY(`id`),
`request_url` VARCHAR (2048) NOT NULL,
`issued_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`expires_at` DATETIME NOT NULL,
`active_method` VARCHAR (32) NOT NULL,
`csrf_token` VARCHAR (255) NOT NULL,
`created_at` DATETIME NOT NULL,
`updated_at` DATETIME NOT NULL
) ENGINE=InnoDB;
CREATE TABLE `selfservice_login_request_methods` (
`id` char(36) NOT NULL,
PRIMARY KEY(`id`),
`method` VARCHAR (32) NOT NULL,
`selfservice_login_request_id` char(36) NOT NULL,
`config` JSON NOT NULL,
`created_at` DATETIME NOT NULL,
`updated_at` DATETIME NOT NULL,
FOREIGN KEY (`selfservice_login_request_id`) REFERENCES `selfservice_login_requests` (`id`) ON DELETE cascade
) ENGINE=InnoDB;
CREATE TABLE `selfservice_registration_requests` (
`id` char(36) NOT NULL,
PRIMARY KEY(`id`),
`request_url` VARCHAR (2048) NOT NULL,
`issued_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`expires_at` DATETIME NOT NULL,
`active_method` VARCHAR (32) NOT NULL,
`csrf_token` VARCHAR (255) NOT NULL,
`created_at` DATETIME NOT NULL,
`updated_at` DATETIME NOT NULL
) ENGINE=InnoDB;
CREATE TABLE `selfservice_registration_request_methods` (
`id` char(36) NOT NULL,
PRIMARY KEY(`id`),
`method` VARCHAR (32) NOT NULL,
`selfservice_registration_request_id` char(36) NOT NULL,
`config` JSON NOT NULL,
`created_at` DATETIME NOT NULL,
`updated_at` DATETIME NOT NULL,
FOREIGN KEY (`selfservice_registration_request_id`) REFERENCES `selfservice_registration_requests` (`id`) ON DELETE cascade
) ENGINE=InnoDB;
CREATE TABLE `selfservice_profile_management_requests` (
`id` char(36) NOT NULL,
PRIMARY KEY(`id`),
`request_url` VARCHAR (2048) NOT NULL,
`issued_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`expires_at` DATETIME NOT NULL,
`form` JSON NOT NULL,
`update_successful` bool 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 DELETE cascade
) ENGINE=InnoDB;

View File

@@ -0,0 +1,5 @@
DROP TABLE "selfservice_login_request_methods";
DROP TABLE "selfservice_login_requests";
DROP TABLE "selfservice_registration_request_methods";
DROP TABLE "selfservice_registration_requests";
DROP TABLE "selfservice_profile_management_requests";

View File

@@ -0,0 +1,55 @@
CREATE TABLE "selfservice_login_requests" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"request_url" VARCHAR (2048) NOT NULL,
"issued_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"expires_at" timestamp NOT NULL,
"active_method" VARCHAR (32) NOT NULL,
"csrf_token" VARCHAR (255) NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);
CREATE TABLE "selfservice_login_request_methods" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"method" VARCHAR (32) NOT NULL,
"selfservice_login_request_id" UUID NOT NULL,
"config" jsonb NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
FOREIGN KEY ("selfservice_login_request_id") REFERENCES "selfservice_login_requests" ("id") ON DELETE cascade
);
CREATE TABLE "selfservice_registration_requests" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"request_url" VARCHAR (2048) NOT NULL,
"issued_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"expires_at" timestamp NOT NULL,
"active_method" VARCHAR (32) NOT NULL,
"csrf_token" VARCHAR (255) NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);
CREATE TABLE "selfservice_registration_request_methods" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"method" VARCHAR (32) NOT NULL,
"selfservice_registration_request_id" UUID NOT NULL,
"config" jsonb NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
FOREIGN KEY ("selfservice_registration_request_id") REFERENCES "selfservice_registration_requests" ("id") ON DELETE cascade
);
CREATE TABLE "selfservice_profile_management_requests" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"request_url" VARCHAR (2048) NOT NULL,
"issued_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"expires_at" timestamp NOT NULL,
"form" jsonb NOT NULL,
"update_successful" bool NOT NULL,
"identity_id" UUID NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
FOREIGN KEY ("identity_id") REFERENCES "identities" ("id") ON DELETE cascade
);

View File

@@ -0,0 +1,5 @@
DROP TABLE "selfservice_login_request_methods";
DROP TABLE "selfservice_login_requests";
DROP TABLE "selfservice_registration_request_methods";
DROP TABLE "selfservice_registration_requests";
DROP TABLE "selfservice_profile_management_requests";

View File

@@ -0,0 +1,50 @@
CREATE TABLE "selfservice_login_requests" (
"id" TEXT PRIMARY KEY,
"request_url" TEXT NOT NULL,
"issued_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"expires_at" DATETIME NOT NULL,
"active_method" TEXT NOT NULL,
"csrf_token" TEXT NOT NULL,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
);
CREATE TABLE "selfservice_login_request_methods" (
"id" TEXT PRIMARY KEY,
"method" TEXT NOT NULL,
"selfservice_login_request_id" char(36) NOT NULL,
"config" TEXT NOT NULL,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL,
FOREIGN KEY (selfservice_login_request_id) REFERENCES selfservice_login_requests (id) ON DELETE cascade
);
CREATE TABLE "selfservice_registration_requests" (
"id" TEXT PRIMARY KEY,
"request_url" TEXT NOT NULL,
"issued_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"expires_at" DATETIME NOT NULL,
"active_method" TEXT NOT NULL,
"csrf_token" TEXT NOT NULL,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
);
CREATE TABLE "selfservice_registration_request_methods" (
"id" TEXT PRIMARY KEY,
"method" TEXT NOT NULL,
"selfservice_registration_request_id" char(36) NOT NULL,
"config" TEXT NOT NULL,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL,
FOREIGN KEY (selfservice_registration_request_id) REFERENCES selfservice_registration_requests (id) ON DELETE cascade
);
CREATE TABLE "selfservice_profile_management_requests" (
"id" TEXT PRIMARY KEY,
"request_url" TEXT NOT NULL,
"issued_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"expires_at" DATETIME NOT NULL,
"form" TEXT NOT NULL,
"update_successful" bool 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 DELETE cascade
);

View File

@@ -0,0 +1 @@
DROP TABLE "sessions";COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1,11 @@
CREATE TABLE "sessions" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"issued_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"expires_at" timestamp NOT NULL,
"authenticated_at" timestamp NOT NULL,
"identity_id" UUID NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
CONSTRAINT "sessions_identities_id_fk" FOREIGN KEY ("identity_id") REFERENCES "identities" ("id") ON DELETE cascade
);COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1 @@
DROP TABLE `sessions`;

View File

@@ -0,0 +1,11 @@
CREATE TABLE `sessions` (
`id` char(36) NOT NULL,
PRIMARY KEY(`id`),
`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 DELETE cascade
) ENGINE=InnoDB;

View File

@@ -0,0 +1 @@
DROP TABLE "sessions";

View File

@@ -0,0 +1,11 @@
CREATE TABLE "sessions" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"issued_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"expires_at" timestamp NOT NULL,
"authenticated_at" timestamp NOT NULL,
"identity_id" UUID NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
FOREIGN KEY ("identity_id") REFERENCES "identities" ("id") ON DELETE cascade
);

View File

@@ -0,0 +1 @@
DROP TABLE "sessions";

View File

@@ -0,0 +1,10 @@
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 DELETE cascade
);

View File

@@ -0,0 +1 @@
DROP TABLE "selfservice_errors";COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1,9 @@
CREATE TABLE "selfservice_errors" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"errors" json NOT NULL,
"seen_at" timestamp NOT NULL,
"was_seen" bool NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1 @@
DROP TABLE `selfservice_errors`;

View File

@@ -0,0 +1,9 @@
CREATE TABLE `selfservice_errors` (
`id` char(36) NOT NULL,
PRIMARY KEY(`id`),
`errors` JSON NOT NULL,
`seen_at` DATETIME NOT NULL,
`was_seen` bool NOT NULL,
`created_at` DATETIME NOT NULL,
`updated_at` DATETIME NOT NULL
) ENGINE=InnoDB;

View File

@@ -0,0 +1 @@
DROP TABLE "selfservice_errors";

View File

@@ -0,0 +1,9 @@
CREATE TABLE "selfservice_errors" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"errors" jsonb NOT NULL,
"seen_at" timestamp NOT NULL,
"was_seen" bool NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);

View File

@@ -0,0 +1 @@
DROP TABLE "selfservice_errors";

View File

@@ -0,0 +1,8 @@
CREATE TABLE "selfservice_errors" (
"id" TEXT PRIMARY KEY,
"errors" TEXT NOT NULL,
"seen_at" DATETIME NOT NULL,
"was_seen" bool NOT NULL,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
);

View File

@@ -0,0 +1 @@
ALTER TABLE identity_credential_identifiers MODIFY COLUMN identifier VARCHAR(255);

View File

@@ -0,0 +1 @@
ALTER TABLE identity_credential_identifiers MODIFY COLUMN identifier VARCHAR(255) BINARY;

View File

@@ -0,0 +1 @@
DROP TABLE "courier_messages";COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1,11 @@
CREATE TABLE "courier_messages" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"type" int NOT NULL,
"status" int NOT NULL,
"body" VARCHAR (255) NOT NULL,
"subject" VARCHAR (255) NOT NULL,
"recipient" VARCHAR (255) NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1 @@
DROP TABLE `courier_messages`;

View File

@@ -0,0 +1,11 @@
CREATE TABLE `courier_messages` (
`id` char(36) NOT NULL,
PRIMARY KEY(`id`),
`type` INTEGER NOT NULL,
`status` INTEGER NOT NULL,
`body` VARCHAR (255) NOT NULL,
`subject` VARCHAR (255) NOT NULL,
`recipient` VARCHAR (255) NOT NULL,
`created_at` DATETIME NOT NULL,
`updated_at` DATETIME NOT NULL
) ENGINE=InnoDB;

View File

@@ -0,0 +1 @@
DROP TABLE "courier_messages";

View File

@@ -0,0 +1,11 @@
CREATE TABLE "courier_messages" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"type" int NOT NULL,
"status" int NOT NULL,
"body" VARCHAR (255) NOT NULL,
"subject" VARCHAR (255) NOT NULL,
"recipient" VARCHAR (255) NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);

View File

@@ -0,0 +1 @@
DROP TABLE "courier_messages";

View File

@@ -0,0 +1,10 @@
CREATE TABLE "courier_messages" (
"id" TEXT PRIMARY KEY,
"type" INTEGER NOT NULL,
"status" INTEGER NOT NULL,
"body" TEXT NOT NULL,
"subject" TEXT NOT NULL,
"recipient" TEXT NOT NULL,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
);

View File

@@ -0,0 +1 @@
ALTER TABLE "selfservice_errors" DROP COLUMN "csrf_token";COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1 @@
ALTER TABLE "selfservice_errors" ADD COLUMN "csrf_token" VARCHAR (255) NOT NULL DEFAULT '';COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1 @@
ALTER TABLE `selfservice_errors` DROP COLUMN `csrf_token`;

View File

@@ -0,0 +1 @@
ALTER TABLE `selfservice_errors` ADD COLUMN `csrf_token` VARCHAR (255) NOT NULL DEFAULT "";

View File

@@ -0,0 +1 @@
ALTER TABLE "selfservice_errors" DROP COLUMN "csrf_token";

View File

@@ -0,0 +1 @@
ALTER TABLE "selfservice_errors" ADD COLUMN "csrf_token" VARCHAR (255) NOT NULL DEFAULT '';

View File

@@ -0,0 +1,12 @@
CREATE TABLE "_selfservice_errors_tmp" (
"id" TEXT PRIMARY KEY,
"errors" TEXT NOT NULL,
"seen_at" DATETIME,
"was_seen" bool NOT NULL,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
);
INSERT INTO "_selfservice_errors_tmp" (id, errors, seen_at, was_seen, created_at, updated_at) SELECT id, errors, seen_at, was_seen, created_at, updated_at FROM "selfservice_errors";
DROP TABLE "selfservice_errors";
ALTER TABLE "_selfservice_errors_tmp" RENAME TO "selfservice_errors";

View File

@@ -0,0 +1 @@
ALTER TABLE "selfservice_errors" ADD COLUMN "csrf_token" TEXT NOT NULL DEFAULT '';

View File

@@ -0,0 +1,2 @@
DROP TABLE "selfservice_verification_requests";COMMIT TRANSACTION;BEGIN TRANSACTION;
DROP TABLE "identity_verifiable_addresses";COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1,32 @@
CREATE TABLE "identity_verifiable_addresses" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"code" VARCHAR (32) NOT NULL,
"status" VARCHAR (16) NOT NULL,
"via" VARCHAR (16) NOT NULL,
"verified" bool NOT NULL,
"value" VARCHAR (400) NOT NULL,
"verified_at" timestamp,
"expires_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"identity_id" UUID NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
CONSTRAINT "identity_verifiable_addresses_identities_id_fk" FOREIGN KEY ("identity_id") REFERENCES "identities" ("id") ON DELETE cascade
);COMMIT TRANSACTION;BEGIN TRANSACTION;
CREATE UNIQUE INDEX "identity_verifiable_addresses_code_uq_idx" ON "identity_verifiable_addresses" (code);COMMIT TRANSACTION;BEGIN TRANSACTION;
CREATE INDEX "identity_verifiable_addresses_code_idx" ON "identity_verifiable_addresses" (code);COMMIT TRANSACTION;BEGIN TRANSACTION;
CREATE UNIQUE INDEX "identity_verifiable_addresses_status_via_uq_idx" ON "identity_verifiable_addresses" (via, value);COMMIT TRANSACTION;BEGIN TRANSACTION;
CREATE INDEX "identity_verifiable_addresses_status_via_idx" ON "identity_verifiable_addresses" (via, value);COMMIT TRANSACTION;BEGIN TRANSACTION;
CREATE TABLE "selfservice_verification_requests" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"request_url" VARCHAR (2048) NOT NULL,
"issued_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"expires_at" timestamp NOT NULL,
"form" json NOT NULL,
"via" VARCHAR (16) NOT NULL,
"csrf_token" VARCHAR (255) NOT NULL,
"success" bool NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1,2 @@
DROP TABLE `selfservice_verification_requests`;
DROP TABLE `identity_verifiable_addresses`;

View File

@@ -0,0 +1,32 @@
CREATE TABLE `identity_verifiable_addresses` (
`id` char(36) NOT NULL,
PRIMARY KEY(`id`),
`code` VARCHAR (32) NOT NULL,
`status` VARCHAR (16) NOT NULL,
`via` VARCHAR (16) NOT NULL,
`verified` bool NOT NULL,
`value` VARCHAR (400) NOT NULL,
`verified_at` DATETIME,
`expires_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`identity_id` char(36) NOT NULL,
`created_at` DATETIME NOT NULL,
`updated_at` DATETIME NOT NULL,
FOREIGN KEY (`identity_id`) REFERENCES `identities` (`id`) ON DELETE cascade
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `identity_verifiable_addresses_code_uq_idx` ON `identity_verifiable_addresses` (`code`);
CREATE INDEX `identity_verifiable_addresses_code_idx` ON `identity_verifiable_addresses` (`code`);
CREATE UNIQUE INDEX `identity_verifiable_addresses_status_via_uq_idx` ON `identity_verifiable_addresses` (`via`, `value`);
CREATE INDEX `identity_verifiable_addresses_status_via_idx` ON `identity_verifiable_addresses` (`via`, `value`);
CREATE TABLE `selfservice_verification_requests` (
`id` char(36) NOT NULL,
PRIMARY KEY(`id`),
`request_url` VARCHAR (2048) NOT NULL,
`issued_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`expires_at` DATETIME NOT NULL,
`form` JSON NOT NULL,
`via` VARCHAR (16) NOT NULL,
`csrf_token` VARCHAR (255) NOT NULL,
`success` bool NOT NULL,
`created_at` DATETIME NOT NULL,
`updated_at` DATETIME NOT NULL
) ENGINE=InnoDB;

View File

@@ -0,0 +1,2 @@
DROP TABLE "selfservice_verification_requests";
DROP TABLE "identity_verifiable_addresses";

View File

@@ -0,0 +1,32 @@
CREATE TABLE "identity_verifiable_addresses" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"code" VARCHAR (32) NOT NULL,
"status" VARCHAR (16) NOT NULL,
"via" VARCHAR (16) NOT NULL,
"verified" bool NOT NULL,
"value" VARCHAR (400) NOT NULL,
"verified_at" timestamp,
"expires_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"identity_id" UUID NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
FOREIGN KEY ("identity_id") REFERENCES "identities" ("id") ON DELETE cascade
);
CREATE UNIQUE INDEX "identity_verifiable_addresses_code_uq_idx" ON "identity_verifiable_addresses" (code);
CREATE INDEX "identity_verifiable_addresses_code_idx" ON "identity_verifiable_addresses" (code);
CREATE UNIQUE INDEX "identity_verifiable_addresses_status_via_uq_idx" ON "identity_verifiable_addresses" (via, value);
CREATE INDEX "identity_verifiable_addresses_status_via_idx" ON "identity_verifiable_addresses" (via, value);
CREATE TABLE "selfservice_verification_requests" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"request_url" VARCHAR (2048) NOT NULL,
"issued_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"expires_at" timestamp NOT NULL,
"form" jsonb NOT NULL,
"via" VARCHAR (16) NOT NULL,
"csrf_token" VARCHAR (255) NOT NULL,
"success" bool NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);

View File

@@ -0,0 +1,2 @@
DROP TABLE "selfservice_verification_requests";
DROP TABLE "identity_verifiable_addresses";

View File

@@ -0,0 +1,30 @@
CREATE TABLE "identity_verifiable_addresses" (
"id" TEXT PRIMARY KEY,
"code" TEXT NOT NULL,
"status" TEXT NOT NULL,
"via" TEXT NOT NULL,
"verified" bool NOT NULL,
"value" TEXT NOT NULL,
"verified_at" DATETIME,
"expires_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"identity_id" char(36) NOT NULL,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL,
FOREIGN KEY (identity_id) REFERENCES identities (id) ON DELETE cascade
);
CREATE UNIQUE INDEX "identity_verifiable_addresses_code_uq_idx" ON "identity_verifiable_addresses" (code);
CREATE INDEX "identity_verifiable_addresses_code_idx" ON "identity_verifiable_addresses" (code);
CREATE UNIQUE INDEX "identity_verifiable_addresses_status_via_uq_idx" ON "identity_verifiable_addresses" (via, value);
CREATE INDEX "identity_verifiable_addresses_status_via_idx" ON "identity_verifiable_addresses" (via, value);
CREATE TABLE "selfservice_verification_requests" (
"id" TEXT PRIMARY KEY,
"request_url" TEXT NOT NULL,
"issued_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"expires_at" DATETIME NOT NULL,
"form" TEXT NOT NULL,
"via" TEXT NOT NULL,
"csrf_token" TEXT NOT NULL,
"success" bool NOT NULL,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
);

View File

@@ -0,0 +1 @@
ALTER TABLE identity_verifiable_addresses MODIFY COLUMN code VARCHAR(255);

View File

@@ -0,0 +1 @@
ALTER TABLE identity_verifiable_addresses MODIFY COLUMN code VARCHAR(255) BINARY;

View File

@@ -0,0 +1,5 @@
UPDATE selfservice_errors SET seen_at = '1980-01-01 00:00:00' WHERE seen_at = NULL;
ALTER TABLE "selfservice_errors" RENAME COLUMN "seen_at" TO "_seen_at_tmp";COMMIT TRANSACTION;BEGIN TRANSACTION;
ALTER TABLE "selfservice_errors" ADD COLUMN "seen_at" timestamp;COMMIT TRANSACTION;BEGIN TRANSACTION;
UPDATE "selfservice_errors" SET "seen_at" = "_seen_at_tmp";COMMIT TRANSACTION;BEGIN TRANSACTION;
ALTER TABLE "selfservice_errors" DROP COLUMN "_seen_at_tmp";COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1,4 @@
ALTER TABLE "selfservice_errors" RENAME COLUMN "seen_at" TO "_seen_at_tmp";COMMIT TRANSACTION;BEGIN TRANSACTION;
ALTER TABLE "selfservice_errors" ADD COLUMN "seen_at" timestamp;COMMIT TRANSACTION;BEGIN TRANSACTION;
UPDATE "selfservice_errors" SET "seen_at" = "_seen_at_tmp";COMMIT TRANSACTION;BEGIN TRANSACTION;
ALTER TABLE "selfservice_errors" DROP COLUMN "_seen_at_tmp";COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1,2 @@
UPDATE selfservice_errors SET seen_at = '1980-01-01 00:00:00' WHERE seen_at = NULL;
ALTER TABLE `selfservice_errors` MODIFY `seen_at` DATETIME;

View File

@@ -0,0 +1 @@
ALTER TABLE `selfservice_errors` MODIFY `seen_at` DATETIME;

View File

@@ -0,0 +1,2 @@
UPDATE selfservice_errors SET seen_at = '1980-01-01 00:00:00' WHERE seen_at = NULL;
ALTER TABLE "selfservice_errors" ALTER COLUMN "seen_at" TYPE timestamp, ALTER COLUMN "seen_at" DROP NOT NULL;

View File

@@ -0,0 +1 @@
ALTER TABLE "selfservice_errors" ALTER COLUMN "seen_at" TYPE timestamp, ALTER COLUMN "seen_at" DROP NOT NULL;

View File

@@ -0,0 +1,13 @@
UPDATE selfservice_errors SET seen_at = '1980-01-01 00:00:00' WHERE seen_at = NULL;
CREATE TABLE "_selfservice_errors_tmp" (
"id" TEXT PRIMARY KEY,
"errors" TEXT NOT NULL,
"seen_at" DATETIME,
"was_seen" bool NOT NULL,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL,
"csrf_token" TEXT NOT NULL DEFAULT ''
);
INSERT INTO "_selfservice_errors_tmp" (id, errors, seen_at, was_seen, created_at, updated_at, csrf_token) SELECT id, errors, seen_at, was_seen, created_at, updated_at, csrf_token FROM "selfservice_errors";
DROP TABLE "selfservice_errors";
ALTER TABLE "_selfservice_errors_tmp" RENAME TO "selfservice_errors";

View File

@@ -0,0 +1,12 @@
CREATE TABLE "_selfservice_errors_tmp" (
"id" TEXT PRIMARY KEY,
"errors" TEXT NOT NULL,
"seen_at" DATETIME,
"was_seen" bool NOT NULL,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL,
"csrf_token" TEXT NOT NULL DEFAULT ''
);
INSERT INTO "_selfservice_errors_tmp" (id, errors, seen_at, was_seen, created_at, updated_at, csrf_token) SELECT id, errors, seen_at, was_seen, created_at, updated_at, csrf_token FROM "selfservice_errors";
DROP TABLE "selfservice_errors";
ALTER TABLE "_selfservice_errors_tmp" RENAME TO "selfservice_errors";

View File

@@ -0,0 +1,5 @@
ALTER TABLE "courier_messages" RENAME COLUMN "body" TO "_body_tmp";COMMIT TRANSACTION;BEGIN TRANSACTION;
ALTER TABLE "courier_messages" ADD COLUMN "body" text;COMMIT TRANSACTION;BEGIN TRANSACTION;
UPDATE "courier_messages" SET "body" = "_body_tmp";COMMIT TRANSACTION;BEGIN TRANSACTION;
ALTER TABLE "courier_messages" ALTER COLUMN "body" SET NOT NULL;COMMIT TRANSACTION;BEGIN TRANSACTION;
ALTER TABLE "courier_messages" DROP COLUMN "_body_tmp";COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1 @@
ALTER TABLE `courier_messages` MODIFY `body` text NOT NULL;

View File

@@ -0,0 +1 @@
ALTER TABLE "courier_messages" ALTER COLUMN "body" TYPE text, ALTER COLUMN "body" SET NOT NULL;

View File

@@ -0,0 +1,13 @@
CREATE TABLE "_courier_messages_tmp" (
"id" TEXT PRIMARY KEY,
"type" INTEGER NOT NULL,
"status" INTEGER NOT NULL,
"body" TEXT NOT NULL,
"subject" TEXT NOT NULL,
"recipient" TEXT NOT NULL,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
);
INSERT INTO "_courier_messages_tmp" (id, type, status, body, subject, recipient, created_at, updated_at) SELECT id, type, status, body, subject, recipient, created_at, updated_at FROM "courier_messages";
DROP TABLE "courier_messages";
ALTER TABLE "_courier_messages_tmp" RENAME TO "courier_messages";

View File

@@ -0,0 +1 @@
ALTER TABLE "selfservice_login_requests" DROP COLUMN "forced";COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1 @@
ALTER TABLE "selfservice_login_requests" ADD COLUMN "forced" bool NOT NULL DEFAULT 'false';COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1 @@
ALTER TABLE `selfservice_login_requests` DROP COLUMN `forced`;

View File

@@ -0,0 +1 @@
ALTER TABLE `selfservice_login_requests` ADD COLUMN `forced` bool NOT NULL DEFAULT false;

View File

@@ -0,0 +1 @@
ALTER TABLE "selfservice_login_requests" DROP COLUMN "forced";

View File

@@ -0,0 +1 @@
ALTER TABLE "selfservice_login_requests" ADD COLUMN "forced" bool NOT NULL DEFAULT 'false';

View File

@@ -0,0 +1,14 @@
CREATE TABLE "_selfservice_login_requests_tmp" (
"id" TEXT PRIMARY KEY,
"request_url" TEXT NOT NULL,
"issued_at" DATETIME NOT NULL DEFAULT 'CURRENT_TIMESTAMP',
"expires_at" DATETIME NOT NULL,
"active_method" TEXT NOT NULL,
"csrf_token" TEXT NOT NULL,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
);
INSERT INTO "_selfservice_login_requests_tmp" (id, request_url, issued_at, expires_at, active_method, csrf_token, created_at, updated_at) SELECT id, request_url, issued_at, expires_at, active_method, csrf_token, created_at, updated_at FROM "selfservice_login_requests";
DROP TABLE "selfservice_login_requests";
ALTER TABLE "_selfservice_login_requests_tmp" RENAME TO "selfservice_login_requests";

View File

@@ -0,0 +1 @@
ALTER TABLE "selfservice_login_requests" ADD COLUMN "forced" bool NOT NULL DEFAULT 'false';

View File

@@ -0,0 +1,3 @@
ALTER TABLE "selfservice_profile_management_requests" ADD COLUMN "form" json NOT NULL DEFAULT '{}';COMMIT TRANSACTION;BEGIN TRANSACTION;
DROP TABLE "selfservice_profile_management_request_methods";COMMIT TRANSACTION;BEGIN TRANSACTION;
ALTER TABLE "selfservice_profile_management_requests" DROP COLUMN "active_method";COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1,12 @@
CREATE TABLE "selfservice_profile_management_request_methods" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"method" VARCHAR (32) NOT NULL,
"selfservice_profile_management_request_id" UUID NOT NULL,
"config" json NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);COMMIT TRANSACTION;BEGIN TRANSACTION;
ALTER TABLE "selfservice_profile_management_requests" ADD COLUMN "active_method" VARCHAR (32);COMMIT TRANSACTION;BEGIN TRANSACTION;
INSERT INTO selfservice_profile_management_request_methods (id, method, selfservice_profile_management_request_id, config) SELECT id, 'traits', id, form FROM selfservice_profile_management_requests;
ALTER TABLE "selfservice_profile_management_requests" DROP COLUMN "form";COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1,5 @@
ALTER TABLE `selfservice_profile_management_requests` ADD COLUMN `form` JSON;
UPDATE selfservice_profile_management_requests SET form=(SELECT * FROM (SELECT m.config FROM selfservice_profile_management_requests AS r INNER JOIN selfservice_profile_management_request_methods AS m ON r.id=m.selfservice_profile_management_request_id) as t);
ALTER TABLE `selfservice_profile_management_requests` MODIFY `form` JSON;
DROP TABLE `selfservice_profile_management_request_methods`;
ALTER TABLE `selfservice_profile_management_requests` DROP COLUMN `active_method`;

View File

@@ -0,0 +1,12 @@
CREATE TABLE `selfservice_profile_management_request_methods` (
`id` char(36) NOT NULL,
PRIMARY KEY(`id`),
`method` VARCHAR (32) NOT NULL,
`selfservice_profile_management_request_id` char(36) NOT NULL,
`config` JSON NOT NULL,
`created_at` DATETIME NOT NULL,
`updated_at` DATETIME NOT NULL
) ENGINE=InnoDB;
ALTER TABLE `selfservice_profile_management_requests` ADD COLUMN `active_method` VARCHAR (32);
INSERT INTO selfservice_profile_management_request_methods (id, method, selfservice_profile_management_request_id, config) SELECT id, 'traits', id, form FROM selfservice_profile_management_requests;
ALTER TABLE `selfservice_profile_management_requests` DROP COLUMN `form`;

View File

@@ -0,0 +1,5 @@
ALTER TABLE "selfservice_profile_management_requests" ADD COLUMN "form" jsonb;
UPDATE selfservice_profile_management_requests SET form=(SELECT * FROM (SELECT m.config FROM selfservice_profile_management_requests AS r INNER JOIN selfservice_profile_management_request_methods AS m ON r.id=m.selfservice_profile_management_request_id) as t);
ALTER TABLE "selfservice_profile_management_requests" ALTER COLUMN "form" TYPE jsonb, ALTER COLUMN "form" DROP NOT NULL;
DROP TABLE "selfservice_profile_management_request_methods";
ALTER TABLE "selfservice_profile_management_requests" DROP COLUMN "active_method";

View File

@@ -0,0 +1,12 @@
CREATE TABLE "selfservice_profile_management_request_methods" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"method" VARCHAR (32) NOT NULL,
"selfservice_profile_management_request_id" UUID NOT NULL,
"config" jsonb NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);
ALTER TABLE "selfservice_profile_management_requests" ADD COLUMN "active_method" VARCHAR (32);
INSERT INTO selfservice_profile_management_request_methods (id, method, selfservice_profile_management_request_id, config) SELECT id, 'traits', id, form FROM selfservice_profile_management_requests;
ALTER TABLE "selfservice_profile_management_requests" DROP COLUMN "form";

View File

@@ -0,0 +1,16 @@
DROP TABLE "selfservice_profile_management_request_methods";
CREATE TABLE "_selfservice_profile_management_requests_tmp" (
"id" TEXT PRIMARY KEY,
"request_url" TEXT NOT NULL,
"issued_at" DATETIME NOT NULL DEFAULT 'CURRENT_TIMESTAMP',
"expires_at" DATETIME NOT NULL,
"identity_id" char(36) NOT NULL,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL,
"update_successful" bool NOT NULL DEFAULT 'false',
FOREIGN KEY (identity_id) REFERENCES identities (id) ON UPDATE NO ACTION ON DELETE CASCADE
);
INSERT INTO "_selfservice_profile_management_requests_tmp" (id, request_url, issued_at, expires_at, identity_id, created_at, updated_at, update_successful) SELECT id, request_url, issued_at, expires_at, identity_id, created_at, updated_at, update_successful FROM "selfservice_profile_management_requests";
DROP TABLE "selfservice_profile_management_requests";
ALTER TABLE "_selfservice_profile_management_requests_tmp" RENAME TO "selfservice_profile_management_requests";

View File

@@ -0,0 +1,26 @@
CREATE TABLE "selfservice_profile_management_request_methods" (
"id" TEXT PRIMARY KEY,
"method" TEXT NOT NULL,
"selfservice_profile_management_request_id" char(36) NOT NULL,
"config" TEXT NOT NULL,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
);
ALTER TABLE "selfservice_profile_management_requests" ADD COLUMN "active_method" TEXT;
INSERT INTO selfservice_profile_management_request_methods (id, method, selfservice_profile_management_request_id, config) SELECT id, 'traits', id, form FROM selfservice_profile_management_requests;
CREATE TABLE "_selfservice_profile_management_requests_tmp" (
"id" TEXT PRIMARY KEY,
"request_url" TEXT NOT NULL,
"issued_at" DATETIME NOT NULL DEFAULT 'CURRENT_TIMESTAMP',
"expires_at" DATETIME NOT NULL,
"update_successful" bool NOT NULL,
"identity_id" char(36) NOT NULL,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL,
"active_method" TEXT,
FOREIGN KEY (identity_id) REFERENCES identities (id) ON UPDATE NO ACTION ON DELETE CASCADE
);
INSERT INTO "_selfservice_profile_management_requests_tmp" (id, request_url, issued_at, expires_at, update_successful, identity_id, created_at, updated_at, active_method) SELECT id, request_url, issued_at, expires_at, update_successful, identity_id, created_at, updated_at, active_method FROM "selfservice_profile_management_requests";
DROP TABLE "selfservice_profile_management_requests";
ALTER TABLE "_selfservice_profile_management_requests_tmp" RENAME TO "selfservice_profile_management_requests";

View File

@@ -0,0 +1 @@
DROP TABLE "continuity_containers";COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1,11 @@
CREATE TABLE "continuity_containers" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"identity_id" UUID,
"name" VARCHAR (255) NOT NULL,
"payload" json,
"expires_at" timestamp NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
CONSTRAINT "continuity_containers_identities_id_fk" FOREIGN KEY ("identity_id") REFERENCES "identities" ("id") ON DELETE cascade
);COMMIT TRANSACTION;BEGIN TRANSACTION;

View File

@@ -0,0 +1 @@
DROP TABLE `continuity_containers`;

View File

@@ -0,0 +1,11 @@
CREATE TABLE `continuity_containers` (
`id` char(36) NOT NULL,
PRIMARY KEY(`id`),
`identity_id` char(36),
`name` VARCHAR (255) NOT NULL,
`payload` JSON,
`expires_at` DATETIME NOT NULL,
`created_at` DATETIME NOT NULL,
`updated_at` DATETIME NOT NULL,
FOREIGN KEY (`identity_id`) REFERENCES `identities` (`id`) ON DELETE cascade
) ENGINE=InnoDB;

View File

@@ -0,0 +1 @@
DROP TABLE "continuity_containers";

View File

@@ -0,0 +1,11 @@
CREATE TABLE "continuity_containers" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"identity_id" UUID,
"name" VARCHAR (255) NOT NULL,
"payload" jsonb,
"expires_at" timestamp NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
FOREIGN KEY ("identity_id") REFERENCES "identities" ("id") ON DELETE cascade
);

View File

@@ -0,0 +1 @@
DROP TABLE "continuity_containers";

View File

@@ -0,0 +1,10 @@
CREATE TABLE "continuity_containers" (
"id" TEXT PRIMARY KEY,
"identity_id" char(36),
"name" TEXT NOT NULL,
"payload" TEXT,
"expires_at" DATETIME NOT NULL,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL,
FOREIGN KEY (identity_id) REFERENCES identities (id) ON DELETE cascade
);

View File

@@ -0,0 +1,3 @@
ALTER TABLE "selfservice_settings_request_methods" RENAME COLUMN "selfservice_settings_request_id" TO "selfservice_profile_management_request_id";COMMIT TRANSACTION;BEGIN TRANSACTION;
ALTER TABLE "selfservice_settings_request_methods" RENAME TO "selfservice_profile_management_request_methods";COMMIT TRANSACTION;BEGIN TRANSACTION;
ALTER TABLE "selfservice_settings_requests" RENAME TO "selfservice_profile_management_requests";COMMIT TRANSACTION;BEGIN TRANSACTION;

Some files were not shown because too many files have changed in this diff Show More