...

Text file src/github.com/ory/x/popx/stub/migrations/legacy/20191100000001_identities.mysql.up.sql

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

     1CREATE TABLE `identities` (
     2`id` char(36) NOT NULL,
     3PRIMARY KEY(`id`),
     4`traits_schema_id` VARCHAR (2048) NOT NULL,
     5`traits` JSON NOT NULL,
     6`created_at` DATETIME NOT NULL,
     7`updated_at` DATETIME NOT NULL
     8) ENGINE=InnoDB;
     9CREATE TABLE `identity_credential_types` (
    10`id` char(36) NOT NULL,
    11PRIMARY KEY(`id`),
    12`name` VARCHAR (32) NOT NULL
    13) ENGINE=InnoDB;
    14CREATE UNIQUE INDEX `identity_credential_types_name_idx` ON `identity_credential_types` (`name`);
    15CREATE TABLE `identity_credentials` (
    16`id` char(36) NOT NULL,
    17PRIMARY KEY(`id`),
    18`config` JSON NOT NULL,
    19`identity_credential_type_id` char(36) NOT NULL,
    20`identity_id` char(36) NOT NULL,
    21`created_at` DATETIME NOT NULL,
    22`updated_at` DATETIME NOT NULL,
    23FOREIGN KEY (`identity_id`) REFERENCES `identities` (`id`) ON DELETE cascade,
    24FOREIGN KEY (`identity_credential_type_id`) REFERENCES `identity_credential_types` (`id`) ON DELETE cascade
    25) ENGINE=InnoDB;
    26CREATE TABLE `identity_credential_identifiers` (
    27`id` char(36) NOT NULL,
    28PRIMARY KEY(`id`),
    29`identifier` VARCHAR (255) NOT NULL,
    30`identity_credential_id` char(36) NOT NULL,
    31`created_at` DATETIME NOT NULL,
    32`updated_at` DATETIME NOT NULL,
    33FOREIGN KEY (`identity_credential_id`) REFERENCES `identity_credentials` (`id`) ON DELETE cascade
    34) ENGINE=InnoDB;
    35CREATE UNIQUE INDEX `identity_credential_identifiers_identifier_idx` ON `identity_credential_identifiers` (`identifier`);

View as plain text