Capture extensive database schema changes, including new tables and updated relationships for better data management and integrity.
1652 lines
41 KiB
JSON
1652 lines
41 KiB
JSON
{
|
|
"id": "538dd2c7-758f-41bd-8b34-f5a6b6b289dd",
|
|
"prevId": "6dbf8343-dced-4b01-a3fd-8c246b0b88e8",
|
|
"version": "7",
|
|
"dialect": "postgresql",
|
|
"tables": {
|
|
"public.api_keys": {
|
|
"name": "api_keys",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"key_hash": {
|
|
"name": "key_hash",
|
|
"type": "varchar(128)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"name": {
|
|
"name": "name",
|
|
"type": "varchar(128)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"prefix": {
|
|
"name": "prefix",
|
|
"type": "varchar(8)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"is_active": {
|
|
"name": "is_active",
|
|
"type": "boolean",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": true
|
|
},
|
|
"last_used_at": {
|
|
"name": "last_used_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"expires_at": {
|
|
"name": "expires_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"api_keys_user_id_idx": {
|
|
"name": "api_keys_user_id_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "user_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
},
|
|
"api_keys_key_hash_idx": {
|
|
"name": "api_keys_key_hash_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "key_hash",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"api_keys_user_id_users_uuid_fk": {
|
|
"name": "api_keys_user_id_users_uuid_fk",
|
|
"tableFrom": "api_keys",
|
|
"tableTo": "users",
|
|
"columnsFrom": [
|
|
"user_id"
|
|
],
|
|
"columnsTo": [
|
|
"uuid"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {
|
|
"api_keys_key_hash_unique": {
|
|
"name": "api_keys_key_hash_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": [
|
|
"key_hash"
|
|
]
|
|
}
|
|
},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.audit_logs": {
|
|
"name": "audit_logs",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"action": {
|
|
"name": "action",
|
|
"type": "varchar(64)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"entity_type": {
|
|
"name": "entity_type",
|
|
"type": "varchar(64)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"entity_id": {
|
|
"name": "entity_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"details": {
|
|
"name": "details",
|
|
"type": "jsonb",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"ip_hash": {
|
|
"name": "ip_hash",
|
|
"type": "varchar(64)",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"user_agent": {
|
|
"name": "user_agent",
|
|
"type": "varchar(255)",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"audit_logs_user_id_idx": {
|
|
"name": "audit_logs_user_id_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "user_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
},
|
|
"audit_logs_action_idx": {
|
|
"name": "audit_logs_action_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "action",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
},
|
|
"audit_logs_entity_idx": {
|
|
"name": "audit_logs_entity_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "entity_type",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
},
|
|
{
|
|
"expression": "entity_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
},
|
|
"audit_logs_created_at_idx": {
|
|
"name": "audit_logs_created_at_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "created_at",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"audit_logs_user_id_users_uuid_fk": {
|
|
"name": "audit_logs_user_id_users_uuid_fk",
|
|
"tableFrom": "audit_logs",
|
|
"tableTo": "users",
|
|
"columnsFrom": [
|
|
"user_id"
|
|
],
|
|
"columnsTo": [
|
|
"uuid"
|
|
],
|
|
"onDelete": "set null",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.categories": {
|
|
"name": "categories",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"name": {
|
|
"name": "name",
|
|
"type": "varchar(64)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"slug": {
|
|
"name": "slug",
|
|
"type": "varchar(64)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"description": {
|
|
"name": "description",
|
|
"type": "varchar(255)",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"icon_url": {
|
|
"name": "icon_url",
|
|
"type": "varchar(512)",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"categories_slug_idx": {
|
|
"name": "categories_slug_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "slug",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {
|
|
"categories_name_unique": {
|
|
"name": "categories_name_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": [
|
|
"name"
|
|
]
|
|
},
|
|
"categories_slug_unique": {
|
|
"name": "categories_slug_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": [
|
|
"slug"
|
|
]
|
|
}
|
|
},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.contents": {
|
|
"name": "contents",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"type": {
|
|
"name": "type",
|
|
"type": "content_type",
|
|
"typeSchema": "public",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"category_id": {
|
|
"name": "category_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"title": {
|
|
"name": "title",
|
|
"type": "varchar(255)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"slug": {
|
|
"name": "slug",
|
|
"type": "varchar(255)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"storage_key": {
|
|
"name": "storage_key",
|
|
"type": "varchar(512)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"mime_type": {
|
|
"name": "mime_type",
|
|
"type": "varchar(128)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"file_size": {
|
|
"name": "file_size",
|
|
"type": "integer",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"views": {
|
|
"name": "views",
|
|
"type": "integer",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": 0
|
|
},
|
|
"usage_count": {
|
|
"name": "usage_count",
|
|
"type": "integer",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": 0
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"deleted_at": {
|
|
"name": "deleted_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
}
|
|
},
|
|
"indexes": {
|
|
"contents_user_id_idx": {
|
|
"name": "contents_user_id_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "user_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
},
|
|
"contents_storage_key_idx": {
|
|
"name": "contents_storage_key_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "storage_key",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
},
|
|
"contents_deleted_at_idx": {
|
|
"name": "contents_deleted_at_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "deleted_at",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"contents_user_id_users_uuid_fk": {
|
|
"name": "contents_user_id_users_uuid_fk",
|
|
"tableFrom": "contents",
|
|
"tableTo": "users",
|
|
"columnsFrom": [
|
|
"user_id"
|
|
],
|
|
"columnsTo": [
|
|
"uuid"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
},
|
|
"contents_category_id_categories_id_fk": {
|
|
"name": "contents_category_id_categories_id_fk",
|
|
"tableFrom": "contents",
|
|
"tableTo": "categories",
|
|
"columnsFrom": [
|
|
"category_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "set null",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {
|
|
"contents_slug_unique": {
|
|
"name": "contents_slug_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": [
|
|
"slug"
|
|
]
|
|
},
|
|
"contents_storage_key_unique": {
|
|
"name": "contents_storage_key_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": [
|
|
"storage_key"
|
|
]
|
|
}
|
|
},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.contents_to_tags": {
|
|
"name": "contents_to_tags",
|
|
"schema": "",
|
|
"columns": {
|
|
"content_id": {
|
|
"name": "content_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"tag_id": {
|
|
"name": "tag_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {
|
|
"contents_to_tags_content_id_contents_id_fk": {
|
|
"name": "contents_to_tags_content_id_contents_id_fk",
|
|
"tableFrom": "contents_to_tags",
|
|
"tableTo": "contents",
|
|
"columnsFrom": [
|
|
"content_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
},
|
|
"contents_to_tags_tag_id_tags_id_fk": {
|
|
"name": "contents_to_tags_tag_id_tags_id_fk",
|
|
"tableFrom": "contents_to_tags",
|
|
"tableTo": "tags",
|
|
"columnsFrom": [
|
|
"tag_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {
|
|
"contents_to_tags_content_id_tag_id_pk": {
|
|
"name": "contents_to_tags_content_id_tag_id_pk",
|
|
"columns": [
|
|
"content_id",
|
|
"tag_id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.favorites": {
|
|
"name": "favorites",
|
|
"schema": "",
|
|
"columns": {
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"content_id": {
|
|
"name": "content_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {
|
|
"favorites_user_id_users_uuid_fk": {
|
|
"name": "favorites_user_id_users_uuid_fk",
|
|
"tableFrom": "favorites",
|
|
"tableTo": "users",
|
|
"columnsFrom": [
|
|
"user_id"
|
|
],
|
|
"columnsTo": [
|
|
"uuid"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
},
|
|
"favorites_content_id_contents_id_fk": {
|
|
"name": "favorites_content_id_contents_id_fk",
|
|
"tableFrom": "favorites",
|
|
"tableTo": "contents",
|
|
"columnsFrom": [
|
|
"content_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {
|
|
"favorites_user_id_content_id_pk": {
|
|
"name": "favorites_user_id_content_id_pk",
|
|
"columns": [
|
|
"user_id",
|
|
"content_id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.permissions": {
|
|
"name": "permissions",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"name": {
|
|
"name": "name",
|
|
"type": "varchar(64)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"slug": {
|
|
"name": "slug",
|
|
"type": "varchar(64)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"description": {
|
|
"name": "description",
|
|
"type": "varchar(128)",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"permissions_slug_idx": {
|
|
"name": "permissions_slug_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "slug",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {
|
|
"permissions_name_unique": {
|
|
"name": "permissions_name_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": [
|
|
"name"
|
|
]
|
|
},
|
|
"permissions_slug_unique": {
|
|
"name": "permissions_slug_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": [
|
|
"slug"
|
|
]
|
|
}
|
|
},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.roles": {
|
|
"name": "roles",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"name": {
|
|
"name": "name",
|
|
"type": "varchar(64)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"slug": {
|
|
"name": "slug",
|
|
"type": "varchar(64)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"description": {
|
|
"name": "description",
|
|
"type": "varchar(128)",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"roles_slug_idx": {
|
|
"name": "roles_slug_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "slug",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {
|
|
"roles_name_unique": {
|
|
"name": "roles_name_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": [
|
|
"name"
|
|
]
|
|
},
|
|
"roles_slug_unique": {
|
|
"name": "roles_slug_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": [
|
|
"slug"
|
|
]
|
|
}
|
|
},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.roles_to_permissions": {
|
|
"name": "roles_to_permissions",
|
|
"schema": "",
|
|
"columns": {
|
|
"role_id": {
|
|
"name": "role_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"permission_id": {
|
|
"name": "permission_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {
|
|
"roles_to_permissions_role_id_roles_id_fk": {
|
|
"name": "roles_to_permissions_role_id_roles_id_fk",
|
|
"tableFrom": "roles_to_permissions",
|
|
"tableTo": "roles",
|
|
"columnsFrom": [
|
|
"role_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
},
|
|
"roles_to_permissions_permission_id_permissions_id_fk": {
|
|
"name": "roles_to_permissions_permission_id_permissions_id_fk",
|
|
"tableFrom": "roles_to_permissions",
|
|
"tableTo": "permissions",
|
|
"columnsFrom": [
|
|
"permission_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {
|
|
"roles_to_permissions_role_id_permission_id_pk": {
|
|
"name": "roles_to_permissions_role_id_permission_id_pk",
|
|
"columns": [
|
|
"role_id",
|
|
"permission_id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.users_to_roles": {
|
|
"name": "users_to_roles",
|
|
"schema": "",
|
|
"columns": {
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"role_id": {
|
|
"name": "role_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {
|
|
"users_to_roles_user_id_users_uuid_fk": {
|
|
"name": "users_to_roles_user_id_users_uuid_fk",
|
|
"tableFrom": "users_to_roles",
|
|
"tableTo": "users",
|
|
"columnsFrom": [
|
|
"user_id"
|
|
],
|
|
"columnsTo": [
|
|
"uuid"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
},
|
|
"users_to_roles_role_id_roles_id_fk": {
|
|
"name": "users_to_roles_role_id_roles_id_fk",
|
|
"tableFrom": "users_to_roles",
|
|
"tableTo": "roles",
|
|
"columnsFrom": [
|
|
"role_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {
|
|
"users_to_roles_user_id_role_id_pk": {
|
|
"name": "users_to_roles_user_id_role_id_pk",
|
|
"columns": [
|
|
"user_id",
|
|
"role_id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.reports": {
|
|
"name": "reports",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"reporter_id": {
|
|
"name": "reporter_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"content_id": {
|
|
"name": "content_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"tag_id": {
|
|
"name": "tag_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"reason": {
|
|
"name": "reason",
|
|
"type": "report_reason",
|
|
"typeSchema": "public",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"description": {
|
|
"name": "description",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"status": {
|
|
"name": "status",
|
|
"type": "report_status",
|
|
"typeSchema": "public",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "'pending'"
|
|
},
|
|
"expires_at": {
|
|
"name": "expires_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"reports_reporter_id_idx": {
|
|
"name": "reports_reporter_id_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "reporter_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
},
|
|
"reports_content_id_idx": {
|
|
"name": "reports_content_id_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "content_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
},
|
|
"reports_tag_id_idx": {
|
|
"name": "reports_tag_id_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "tag_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
},
|
|
"reports_status_idx": {
|
|
"name": "reports_status_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "status",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
},
|
|
"reports_expires_at_idx": {
|
|
"name": "reports_expires_at_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "expires_at",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"reports_reporter_id_users_uuid_fk": {
|
|
"name": "reports_reporter_id_users_uuid_fk",
|
|
"tableFrom": "reports",
|
|
"tableTo": "users",
|
|
"columnsFrom": [
|
|
"reporter_id"
|
|
],
|
|
"columnsTo": [
|
|
"uuid"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
},
|
|
"reports_content_id_contents_id_fk": {
|
|
"name": "reports_content_id_contents_id_fk",
|
|
"tableFrom": "reports",
|
|
"tableTo": "contents",
|
|
"columnsFrom": [
|
|
"content_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
},
|
|
"reports_tag_id_tags_id_fk": {
|
|
"name": "reports_tag_id_tags_id_fk",
|
|
"tableFrom": "reports",
|
|
"tableTo": "tags",
|
|
"columnsFrom": [
|
|
"tag_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.sessions": {
|
|
"name": "sessions",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"refresh_token": {
|
|
"name": "refresh_token",
|
|
"type": "varchar(512)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"user_agent": {
|
|
"name": "user_agent",
|
|
"type": "varchar(255)",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"ip_hash": {
|
|
"name": "ip_hash",
|
|
"type": "varchar(64)",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"is_valid": {
|
|
"name": "is_valid",
|
|
"type": "boolean",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": true
|
|
},
|
|
"expires_at": {
|
|
"name": "expires_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"sessions_user_id_idx": {
|
|
"name": "sessions_user_id_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "user_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
},
|
|
"sessions_refresh_token_idx": {
|
|
"name": "sessions_refresh_token_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "refresh_token",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
},
|
|
"sessions_expires_at_idx": {
|
|
"name": "sessions_expires_at_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "expires_at",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"sessions_user_id_users_uuid_fk": {
|
|
"name": "sessions_user_id_users_uuid_fk",
|
|
"tableFrom": "sessions",
|
|
"tableTo": "users",
|
|
"columnsFrom": [
|
|
"user_id"
|
|
],
|
|
"columnsTo": [
|
|
"uuid"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {
|
|
"sessions_refresh_token_unique": {
|
|
"name": "sessions_refresh_token_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": [
|
|
"refresh_token"
|
|
]
|
|
}
|
|
},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.tags": {
|
|
"name": "tags",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"name": {
|
|
"name": "name",
|
|
"type": "varchar(64)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"slug": {
|
|
"name": "slug",
|
|
"type": "varchar(64)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"tags_slug_idx": {
|
|
"name": "tags_slug_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "slug",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"tags_user_id_users_uuid_fk": {
|
|
"name": "tags_user_id_users_uuid_fk",
|
|
"tableFrom": "tags",
|
|
"tableTo": "users",
|
|
"columnsFrom": [
|
|
"user_id"
|
|
],
|
|
"columnsTo": [
|
|
"uuid"
|
|
],
|
|
"onDelete": "set null",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {
|
|
"tags_name_unique": {
|
|
"name": "tags_name_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": [
|
|
"name"
|
|
]
|
|
},
|
|
"tags_slug_unique": {
|
|
"name": "tags_slug_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": [
|
|
"slug"
|
|
]
|
|
}
|
|
},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.users": {
|
|
"name": "users",
|
|
"schema": "",
|
|
"columns": {
|
|
"uuid": {
|
|
"name": "uuid",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"status": {
|
|
"name": "status",
|
|
"type": "user_status",
|
|
"typeSchema": "public",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "'pending'"
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"type": "bytea",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"email_hash": {
|
|
"name": "email_hash",
|
|
"type": "varchar(64)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"display_name": {
|
|
"name": "display_name",
|
|
"type": "varchar(32)",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"type": "varchar(32)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"password_hash": {
|
|
"name": "password_hash",
|
|
"type": "varchar(100)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"avatar_url": {
|
|
"name": "avatar_url",
|
|
"type": "varchar(512)",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"bio": {
|
|
"name": "bio",
|
|
"type": "varchar(255)",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"two_factor_secret": {
|
|
"name": "two_factor_secret",
|
|
"type": "bytea",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"is_two_factor_enabled": {
|
|
"name": "is_two_factor_enabled",
|
|
"type": "boolean",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": false
|
|
},
|
|
"terms_version": {
|
|
"name": "terms_version",
|
|
"type": "varchar(16)",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"privacy_version": {
|
|
"name": "privacy_version",
|
|
"type": "varchar(16)",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"gdpr_accepted_at": {
|
|
"name": "gdpr_accepted_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"last_login_at": {
|
|
"name": "last_login_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"deleted_at": {
|
|
"name": "deleted_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
}
|
|
},
|
|
"indexes": {
|
|
"users_uuid_idx": {
|
|
"name": "users_uuid_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "uuid",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
},
|
|
"users_email_hash_idx": {
|
|
"name": "users_email_hash_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "email_hash",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
},
|
|
"users_username_idx": {
|
|
"name": "users_username_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "username",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
},
|
|
"users_status_idx": {
|
|
"name": "users_status_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "status",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {
|
|
"users_email_hash_unique": {
|
|
"name": "users_email_hash_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": [
|
|
"email_hash"
|
|
]
|
|
},
|
|
"users_username_unique": {
|
|
"name": "users_username_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": [
|
|
"username"
|
|
]
|
|
}
|
|
},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
}
|
|
},
|
|
"enums": {
|
|
"public.content_type": {
|
|
"name": "content_type",
|
|
"schema": "public",
|
|
"values": [
|
|
"meme",
|
|
"gif"
|
|
]
|
|
},
|
|
"public.report_reason": {
|
|
"name": "report_reason",
|
|
"schema": "public",
|
|
"values": [
|
|
"inappropriate",
|
|
"spam",
|
|
"copyright",
|
|
"other"
|
|
]
|
|
},
|
|
"public.report_status": {
|
|
"name": "report_status",
|
|
"schema": "public",
|
|
"values": [
|
|
"pending",
|
|
"reviewed",
|
|
"resolved",
|
|
"dismissed"
|
|
]
|
|
},
|
|
"public.user_status": {
|
|
"name": "user_status",
|
|
"schema": "public",
|
|
"values": [
|
|
"active",
|
|
"verification",
|
|
"suspended",
|
|
"pending",
|
|
"deleted"
|
|
]
|
|
}
|
|
},
|
|
"schemas": {},
|
|
"sequences": {},
|
|
"roles": {},
|
|
"policies": {},
|
|
"views": {},
|
|
"_meta": {
|
|
"columns": {},
|
|
"schemas": {},
|
|
"tables": {}
|
|
}
|
|
} |