sso-core/migrations/meta/0002_snapshot.json
2024-06-02 20:08:56 +03:00

1064 lines
28 KiB
JSON

{
"version": "5",
"dialect": "mysql",
"id": "31269eb0-9aaf-417a-983c-68912644e6dc",
"prevId": "fa80e0d2-53bc-4557-a754-bc9fd9cad9aa",
"tables": {
"audit_log": {
"name": "audit_log",
"columns": {
"id": {
"name": "id",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": true
},
"action": {
"name": "action",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"actor_ip": {
"name": "actor_ip",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"actor_ua": {
"name": "actor_ua",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"flagged": {
"name": "flagged",
"type": "tinyint",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "datetime(6)",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "current_timestamp(6)"
},
"actorId": {
"name": "actorId",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"audit_log_actorId_user_id_fk": {
"name": "audit_log_actorId_user_id_fk",
"tableFrom": "audit_log",
"tableTo": "user",
"columnsFrom": [
"actorId"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"document": {
"name": "document",
"columns": {
"id": {
"name": "id",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"slug": {
"name": "slug",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"body": {
"name": "body",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"authorId": {
"name": "authorId",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "datetime(6)",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "current_timestamp(6)"
},
"updated_at": {
"name": "updated_at",
"type": "datetime(6)",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "current_timestamp(6)"
}
},
"indexes": {},
"foreignKeys": {
"document_authorId_user_id_fk": {
"name": "document_authorId_user_id_fk",
"tableFrom": "document",
"tableTo": "user",
"columnsFrom": [
"authorId"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"o_auth2_client": {
"name": "o_auth2_client",
"columns": {
"id": {
"name": "id",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": true
},
"client_id": {
"name": "client_id",
"type": "varchar(36)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"client_secret": {
"name": "client_secret",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"title": {
"name": "title",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"scope": {
"name": "scope",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"grants": {
"name": "grants",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "('authorization_code')"
},
"activated": {
"name": "activated",
"type": "tinyint",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 0
},
"verified": {
"name": "verified",
"type": "tinyint",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 0
},
"pictureId": {
"name": "pictureId",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"ownerId": {
"name": "ownerId",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "datetime(6)",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "current_timestamp(6)"
},
"updated_at": {
"name": "updated_at",
"type": "datetime(6)",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "current_timestamp(6)"
}
},
"indexes": {},
"foreignKeys": {
"o_auth2_client_pictureId_upload_id_fk": {
"name": "o_auth2_client_pictureId_upload_id_fk",
"tableFrom": "o_auth2_client",
"tableTo": "upload",
"columnsFrom": [
"pictureId"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"o_auth2_client_ownerId_user_id_fk": {
"name": "o_auth2_client_ownerId_user_id_fk",
"tableFrom": "o_auth2_client",
"tableTo": "user",
"columnsFrom": [
"ownerId"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"IDX_e9d16c213910ad57bd05e97b42": {
"name": "IDX_e9d16c213910ad57bd05e97b42",
"columns": [
"client_id"
]
}
}
},
"o_auth2_client_authorization": {
"name": "o_auth2_client_authorization",
"columns": {
"id": {
"name": "id",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": true
},
"scope": {
"name": "scope",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"clientId": {
"name": "clientId",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"userId": {
"name": "userId",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "datetime(6)",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "current_timestamp(6)"
},
"current": {
"name": "current",
"type": "tinyint",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 1
}
},
"indexes": {},
"foreignKeys": {
"o_auth2_client_authorization_clientId_o_auth2_client_id_fk": {
"name": "o_auth2_client_authorization_clientId_o_auth2_client_id_fk",
"tableFrom": "o_auth2_client_authorization",
"tableTo": "o_auth2_client",
"columnsFrom": [
"clientId"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"o_auth2_client_authorization_userId_user_id_fk": {
"name": "o_auth2_client_authorization_userId_user_id_fk",
"tableFrom": "o_auth2_client_authorization",
"tableTo": "user",
"columnsFrom": [
"userId"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"o_auth2_client_manager": {
"name": "o_auth2_client_manager",
"columns": {
"id": {
"name": "id",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": true
},
"clientId": {
"name": "clientId",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"userId": {
"name": "userId",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"issuerId": {
"name": "issuerId",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "datetime(6)",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "current_timestamp(6)"
},
"updated_at": {
"name": "updated_at",
"type": "datetime(6)",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "current_timestamp(6)"
}
},
"indexes": {},
"foreignKeys": {
"o_auth2_client_manager_clientId_o_auth2_client_id_fk": {
"name": "o_auth2_client_manager_clientId_o_auth2_client_id_fk",
"tableFrom": "o_auth2_client_manager",
"tableTo": "o_auth2_client",
"columnsFrom": [
"clientId"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"o_auth2_client_manager_userId_user_id_fk": {
"name": "o_auth2_client_manager_userId_user_id_fk",
"tableFrom": "o_auth2_client_manager",
"tableTo": "user",
"columnsFrom": [
"userId"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"o_auth2_client_manager_issuerId_user_id_fk": {
"name": "o_auth2_client_manager_issuerId_user_id_fk",
"tableFrom": "o_auth2_client_manager",
"tableTo": "user",
"columnsFrom": [
"issuerId"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"o_auth2_client_url": {
"name": "o_auth2_client_url",
"columns": {
"id": {
"name": "id",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": true
},
"url": {
"name": "url",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"type": {
"name": "type",
"type": "enum('redirect_uri','terms','privacy','website')",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "timestamp(6)",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "current_timestamp(6)"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp(6)",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "current_timestamp(6)"
},
"clientId": {
"name": "clientId",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"o_auth2_client_url_clientId_o_auth2_client_id_fk": {
"name": "o_auth2_client_url_clientId_o_auth2_client_id_fk",
"tableFrom": "o_auth2_client_url",
"tableTo": "o_auth2_client",
"columnsFrom": [
"clientId"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"o_auth2_token": {
"name": "o_auth2_token",
"columns": {
"id": {
"name": "id",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": true
},
"type": {
"name": "type",
"type": "enum('code','access_token','refresh_token')",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"token": {
"name": "token",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"scope": {
"name": "scope",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "current_timestamp()"
},
"userId": {
"name": "userId",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"clientId": {
"name": "clientId",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"nonce": {
"name": "nonce",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "datetime(6)",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "current_timestamp(6)"
},
"updated_at": {
"name": "updated_at",
"type": "datetime(6)",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "current_timestamp(6)"
},
"pcke": {
"name": "pcke",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"o_auth2_token_userId_user_id_fk": {
"name": "o_auth2_token_userId_user_id_fk",
"tableFrom": "o_auth2_token",
"tableTo": "user",
"columnsFrom": [
"userId"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"o_auth2_token_clientId_o_auth2_client_id_fk": {
"name": "o_auth2_token_clientId_o_auth2_client_id_fk",
"tableFrom": "o_auth2_token",
"tableTo": "o_auth2_client",
"columnsFrom": [
"clientId"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"privilege": {
"name": "privilege",
"columns": {
"id": {
"name": "id",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"clientId": {
"name": "clientId",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"automatic": {
"name": "automatic",
"type": "tinyint",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 0
}
},
"indexes": {},
"foreignKeys": {
"privilege_clientId_o_auth2_client_id_fk": {
"name": "privilege_clientId_o_auth2_client_id_fk",
"tableFrom": "privilege",
"tableTo": "o_auth2_client",
"columnsFrom": [
"clientId"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"upload": {
"name": "upload",
"columns": {
"id": {
"name": "id",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": true
},
"original_name": {
"name": "original_name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"mimetype": {
"name": "mimetype",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"file": {
"name": "file",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"uploaderId": {
"name": "uploaderId",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "datetime(6)",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "current_timestamp(6)"
},
"updated_at": {
"name": "updated_at",
"type": "datetime(6)",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "current_timestamp(6)"
}
},
"indexes": {},
"foreignKeys": {
"upload_uploaderId_user_id_fk": {
"name": "upload_uploaderId_user_id_fk",
"tableFrom": "upload",
"tableTo": "user",
"columnsFrom": [
"uploaderId"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "cascade"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"user": {
"name": "user",
"columns": {
"id": {
"name": "id",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": true
},
"uuid": {
"name": "uuid",
"type": "varchar(36)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"username": {
"name": "username",
"type": "varchar(26)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"email": {
"name": "email",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"display_name": {
"name": "display_name",
"type": "varchar(32)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"password": {
"name": "password",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"activated": {
"name": "activated",
"type": "tinyint",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 0
},
"activity_at": {
"name": "activity_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "current_timestamp()"
},
"pictureId": {
"name": "pictureId",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "datetime(6)",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "current_timestamp(6)"
},
"updated_at": {
"name": "updated_at",
"type": "datetime(6)",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "current_timestamp(6)"
}
},
"indexes": {},
"foreignKeys": {
"user_pictureId_upload_id_fk": {
"name": "user_pictureId_upload_id_fk",
"tableFrom": "user",
"tableTo": "upload",
"columnsFrom": [
"pictureId"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "cascade"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"IDX_a95e949168be7b7ece1a2382fe": {
"name": "IDX_a95e949168be7b7ece1a2382fe",
"columns": [
"uuid"
]
},
"IDX_78a916df40e02a9deb1c4b75ed": {
"name": "IDX_78a916df40e02a9deb1c4b75ed",
"columns": [
"username"
]
},
"IDX_e12875dfb3b1d92d7d7c5377e2": {
"name": "IDX_e12875dfb3b1d92d7d7c5377e2",
"columns": [
"email"
]
}
}
},
"user_privileges_privilege": {
"name": "user_privileges_privilege",
"columns": {
"userId": {
"name": "userId",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"privilegeId": {
"name": "privilegeId",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"IDX_0664a7ff494a1859a09014c0f1": {
"name": "IDX_0664a7ff494a1859a09014c0f1",
"columns": [
"userId"
],
"isUnique": false
},
"IDX_e71171f4ed20bc8564a1819d0b": {
"name": "IDX_e71171f4ed20bc8564a1819d0b",
"columns": [
"privilegeId"
],
"isUnique": false
}
},
"foreignKeys": {
"user_privileges_privilege_userId_user_id_fk": {
"name": "user_privileges_privilege_userId_user_id_fk",
"tableFrom": "user_privileges_privilege",
"tableTo": "user",
"columnsFrom": [
"userId"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "cascade"
},
"user_privileges_privilege_privilegeId_privilege_id_fk": {
"name": "user_privileges_privilege_privilegeId_privilege_id_fk",
"tableFrom": "user_privileges_privilege",
"tableTo": "privilege",
"columnsFrom": [
"privilegeId"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "cascade"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"user_token": {
"name": "user_token",
"columns": {
"id": {
"name": "id",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": true
},
"token": {
"name": "token",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"type": {
"name": "type",
"type": "enum('generic','activation','deactivation','password','login','gdpr','totp','public_key','invite','recovery')",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"userId": {
"name": "userId",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"nonce": {
"name": "nonce",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"metadata": {
"name": "metadata",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "datetime(6)",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "current_timestamp(6)"
}
},
"indexes": {},
"foreignKeys": {
"user_token_userId_user_id_fk": {
"name": "user_token_userId_user_id_fk",
"tableFrom": "user_token",
"tableTo": "user",
"columnsFrom": [
"userId"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
}
}