Files
OJ2/apps/api/src/db/meta/0000_snapshot.json
T
xuyueandClaude Opus 5 586c88f629
Deploy / deploy (push) Has been cancelled
build(数据库): 改用 drizzle migration,加提交列表索引、清掉 Django 残留
一条线上的三件事:让 drizzle 的迁移机制真正可用 → 用它加索引 → 用它清掉
不再需要的 Django 表,最后接进部署和 CI。

## 1. 让 drizzle-kit generate 可用

原本以为不能用:只加一个索引,generate 却吐出一堆噪音,其中 5 条
`DROP SEQUENCE auth_*/django_*` 打到生产库上会直接搞坏旧后端。
逐个查下来全是 `pull` 出的基线自己不能 round-trip,都是可修的:

- **快照里的 Django 序列**:tablesFilter 只过滤表、不过滤它们的序列。
  已从 0000_snapshot.json 清掉。
- **bigint 上限精度**:pull 生成的 `maxValue: 9223372036854775807` 是 JS
  number 字面量,round-trip 成 ...776000,每次 generate 都多出 10 条
  ALTER COLUMN。改成字符串。
- **表达式索引的 opclass**:problem_tag_name_ci_unique 在快照里带
  opclass,drizzle 自己序列化不出来,导致每次 drop + recreate。已去掉。

改完 `generate` 是干净的 no-op。

两个改不掉、只能绕的写进了 CLAUDE.md:索引 `.desc()` 生成 SQL 时会被丢
(单列索引不写方向即可,Postgres 用 Index Scan Backward 服务 ORDER BY
DESC,实测同样 0.08ms);migrator 把所有语句包一个事务,
CREATE INDEX CONCURRENTLY 跑不了。

最容易吃亏的是 drizzle 没有 --fake-initial:对已有数据的库直接 migrate
会从 0000 跑起、撞表回滚,**而且 exit 1 但一个错误都不打印**。

## 2. 0001 提交列表索引

`WHERE contest_id IS NULL ORDER BY create_time DESC LIMIT n` 用不上现有的
contest_create_time_idx (contest_id, create_time DESC) —— Postgres 不把
`IS NULL` 当成能吃掉首列、从而继承第二列有序性的等值条件。把
enable_seqscan / enable_bitmapscan 全关掉逼它用也不肯,宁可走单列
contest_id 索引再全量排序。于是每翻一页都 Parallel Seq Scan 扫完整张表。

换成部分索引后谓词由索引自己保证,索引序就是查询要的排序序。生产快照
(12.3 万条提交)实测首页取 10 行:61.8ms / 读 18936 blocks →
0.22ms / 读 34 blocks。端到端 94ms → 6ms。

真正要命的不是单次 61ms,是每个请求都要把 169MB 的表刷一遍
shared_buffers —— 一节课几十个学生同时开提交列表,磁盘和缓存直接被打穿。

## 3. 0002 删掉 Django 残留

确认旧 Django 后端不再使用、也不再作为回滚路径。删前核实过:没有任何
OJ2 保留的表引用这 7 张,3 条外键全在它们内部(所以不用 CASCADE,真有
漏网的会报错而不是被悄悄级联掉);5 个序列都由各自的表 owned,随
DROP TABLE 一并消失;数据全是 Django 自身元数据。tablesFilter 随之移除。

**回滚路径就此作废** —— CLAUDE.md 开头和 runbook 的「回滚保证」「七、回滚」
都改了。这条迁移已在本机 dev 库和生产快照副本上跑通,**生产库尚未执行**。

## 4. migrate 接进部署与 CI

deploy.sh 在构建之后、起栈之前跑 `oj2-api migrate`,失败就中止部署(旧
容器原样还在跑)。CI 走的也是 deploy.sh,所以不用给 GitHub 配数据库凭据,
也不用把生产库对外开放。

迁移文件**不内嵌进二进制**,随镜像装在 /usr/local/share/oj2/migrations。
这样 drizzle 的 migrate() 能原样用 —— 靠 _journal.json 自动发现,新增迁移
不用改任何代码,和 Django 扫 migrations/ 是一回事。内嵌就得为每条迁移
手写一行 import,那是迟早会漏的账。(CLAUDE.md 里「单二进制不能读文件」
那条讲的是 node_modules 和 import.meta.dir 推路径,按显式绝对路径读一个
数据目录不在此列。)

三道闸门,都是写完测出来才补上的:

- **破坏性迁移拦截**:DROP TABLE / DROP COLUMN / DROP SCHEMA /
  ALTER COLUMN ... TYPE / TRUNCATE 命中就退出 4,需要
  `OJ2_ALLOW_DESTRUCTIVE=1` 显式放行。DROP INDEX / DROP CONSTRAINT 不算,
  拦了只会让人习惯性带上放行开关。扫描前先剥注释,避免误报。
- **基线缺失**:退出 3 并直接打印该敲的 SQL。注意判的是
  `max(created_at) < 0` 而不是「表不存在」—— 表存在而为空(上次迁移失败
  留下的)同样是没基线。
- **迁移目录读不到**:这是最可能犯的错(Dockerfile 漏拷),原本是 drizzle
  的堆栈,现在直接说该检查哪一行。

另外发现 0000_crazy_gateway.sql 是 pull 的产物,**整份被 /* */ 包着,
可执行语句 0 条**,所以这个库根本不能靠迁移自举建表。原先写的「空库就从
0000 建」跑起来会炸在一个和真实原因毫不相干的 unterminated /* comment 上。
现在如实说明:结构只能来自 docs/specs/schema.sql 或生产 dump。

验证:镜像内编译(ARTIFACTS=build)出的真实镜像跑完五种场景 —— 拦截、
放行、幂等、无基线、漏拷目录,全部符合预期;dev 形态同样五种场景全过。
tsc / 路由遮蔽 / deploy.sh 语法 / generate no-op 都通过。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-26 07:56:30 -06:00

3842 lines
101 KiB
JSON

{
"id": "00000000-0000-0000-0000-000000000000",
"prevId": "",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.ai_analysis": {
"name": "ai_analysis",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "bigint",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "byDefault",
"name": "ai_analysis_id_seq",
"increment": "1",
"minValue": "1",
"maxValue": "9223372036854775807",
"startWith": "1",
"cache": "1",
"cycle": false,
"schema": "public"
}
},
"provider": {
"name": "provider",
"type": "text",
"primaryKey": false,
"notNull": true
},
"data": {
"name": "data",
"type": "jsonb",
"primaryKey": false,
"notNull": true
},
"system_prompt": {
"name": "system_prompt",
"type": "text",
"primaryKey": false,
"notNull": true
},
"user_prompt": {
"name": "user_prompt",
"type": "text",
"primaryKey": false,
"notNull": true
},
"analysis": {
"name": "analysis",
"type": "text",
"primaryKey": false,
"notNull": true
},
"create_time": {
"name": "create_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"model": {
"name": "model",
"type": "text",
"primaryKey": false,
"notNull": true
},
"is_pinned": {
"name": "is_pinned",
"type": "boolean",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"ai_analysis_user_id_3aa23011": {
"name": "ai_analysis_user_id_3aa23011",
"columns": [
{
"expression": "user_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"ai_analysis_user_id_3aa23011_fk_user_id": {
"name": "ai_analysis_user_id_3aa23011_fk_user_id",
"tableFrom": "ai_analysis",
"tableTo": "user",
"schemaTo": "public",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.announcement": {
"name": "announcement",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"create_time": {
"name": "create_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"last_update_time": {
"name": "last_update_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"visible": {
"name": "visible",
"type": "boolean",
"primaryKey": false,
"notNull": true
},
"created_by_id": {
"name": "created_by_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"tag": {
"name": "tag",
"type": "text",
"primaryKey": false,
"notNull": true
},
"top": {
"name": "top",
"type": "boolean",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"announcement_created_by_id_359ccf50": {
"name": "announcement_created_by_id_359ccf50",
"columns": [
{
"expression": "created_by_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"announcement_list_idx": {
"name": "announcement_list_idx",
"columns": [
{
"expression": "visible",
"asc": true,
"nulls": "last",
"opclass": "bool_ops",
"isExpression": false
},
{
"expression": "top",
"asc": false,
"nulls": "first",
"opclass": "bool_ops",
"isExpression": false
},
{
"expression": "create_time",
"asc": false,
"nulls": "first",
"opclass": "bool_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"announcement_created_by_id_359ccf50_fk_user_id": {
"name": "announcement_created_by_id_359ccf50_fk_user_id",
"tableFrom": "announcement",
"tableTo": "user",
"schemaTo": "public",
"columnsFrom": [
"created_by_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.achievement": {
"name": "achievement",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "bigint",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "byDefault",
"name": "achievement_id_seq",
"increment": "1",
"minValue": "1",
"maxValue": "9223372036854775807",
"startWith": "1",
"cache": "1",
"cycle": false,
"schema": "public"
}
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": true
},
"icon": {
"name": "icon",
"type": "text",
"primaryKey": false,
"notNull": true
},
"rarity": {
"name": "rarity",
"type": "text",
"primaryKey": false,
"notNull": true
},
"hidden": {
"name": "hidden",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"metric": {
"name": "metric",
"type": "text",
"primaryKey": false,
"notNull": true
},
"operator": {
"name": "operator",
"type": "text",
"primaryKey": false,
"notNull": true
},
"threshold": {
"name": "threshold",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"visible": {
"name": "visible",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"unlock_count": {
"name": "unlock_count",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"order": {
"name": "order",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"create_time": {
"name": "create_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.contest": {
"name": "contest",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": true
},
"password": {
"name": "password",
"type": "text",
"primaryKey": false,
"notNull": false
},
"start_time": {
"name": "start_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"end_time": {
"name": "end_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"create_time": {
"name": "create_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"last_update_time": {
"name": "last_update_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"visible": {
"name": "visible",
"type": "boolean",
"primaryKey": false,
"notNull": true
},
"created_by_id": {
"name": "created_by_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"allowed_ip_ranges": {
"name": "allowed_ip_ranges",
"type": "jsonb",
"primaryKey": false,
"notNull": true
},
"tag": {
"name": "tag",
"type": "text",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"contest_created_by_id_a763ca7e": {
"name": "contest_created_by_id_a763ca7e",
"columns": [
{
"expression": "created_by_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"contest_created_by_id_a763ca7e_fk_user_id": {
"name": "contest_created_by_id_a763ca7e_fk_user_id",
"tableFrom": "contest",
"tableTo": "user",
"schemaTo": "public",
"columnsFrom": [
"created_by_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.contest_announcement": {
"name": "contest_announcement",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"create_time": {
"name": "create_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"contest_id": {
"name": "contest_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"created_by_id": {
"name": "created_by_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"visible": {
"name": "visible",
"type": "boolean",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"contest_announcement_contest_id_a8cb419f": {
"name": "contest_announcement_contest_id_a8cb419f",
"columns": [
{
"expression": "contest_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"contest_announcement_created_by_id_469a14ce": {
"name": "contest_announcement_created_by_id_469a14ce",
"columns": [
{
"expression": "created_by_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"contest_announcement_contest_id_a8cb419f_fk_contest_id": {
"name": "contest_announcement_contest_id_a8cb419f_fk_contest_id",
"tableFrom": "contest_announcement",
"tableTo": "contest",
"schemaTo": "public",
"columnsFrom": [
"contest_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"contest_announcement_created_by_id_469a14ce_fk_user_id": {
"name": "contest_announcement_created_by_id_469a14ce_fk_user_id",
"tableFrom": "contest_announcement",
"tableTo": "user",
"schemaTo": "public",
"columnsFrom": [
"created_by_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.flowchart_submission": {
"name": "flowchart_submission",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"mermaid_code": {
"name": "mermaid_code",
"type": "text",
"primaryKey": false,
"notNull": true
},
"flowchart_data": {
"name": "flowchart_data",
"type": "jsonb",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"create_time": {
"name": "create_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"ai_score": {
"name": "ai_score",
"type": "double precision",
"primaryKey": false,
"notNull": false
},
"ai_grade": {
"name": "ai_grade",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"ai_feedback": {
"name": "ai_feedback",
"type": "text",
"primaryKey": false,
"notNull": false
},
"ai_suggestions": {
"name": "ai_suggestions",
"type": "text",
"primaryKey": false,
"notNull": false
},
"ai_criteria_details": {
"name": "ai_criteria_details",
"type": "jsonb",
"primaryKey": false,
"notNull": true
},
"ai_provider": {
"name": "ai_provider",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"ai_model": {
"name": "ai_model",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"processing_time": {
"name": "processing_time",
"type": "double precision",
"primaryKey": false,
"notNull": false
},
"evaluation_time": {
"name": "evaluation_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"problem_id": {
"name": "problem_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"flowchart_problem_time_idx": {
"name": "flowchart_problem_time_idx",
"columns": [
{
"expression": "problem_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
},
{
"expression": "create_time",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"flowchart_status_idx": {
"name": "flowchart_status_idx",
"columns": [
{
"expression": "status",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"flowchart_submission_id_0dbfc4f9_like": {
"name": "flowchart_submission_id_0dbfc4f9_like",
"columns": [
{
"expression": "id",
"asc": true,
"nulls": "last",
"opclass": "text_pattern_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"flowchart_submission_problem_id_8551edbf": {
"name": "flowchart_submission_problem_id_8551edbf",
"columns": [
{
"expression": "problem_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"flowchart_submission_user_id_225c83e8": {
"name": "flowchart_submission_user_id_225c83e8",
"columns": [
{
"expression": "user_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"flowchart_user_time_idx": {
"name": "flowchart_user_time_idx",
"columns": [
{
"expression": "user_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
},
{
"expression": "create_time",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"flowchart_submission_problem_id_8551edbf_fk_problem_id": {
"name": "flowchart_submission_problem_id_8551edbf_fk_problem_id",
"tableFrom": "flowchart_submission",
"tableTo": "problem",
"schemaTo": "public",
"columnsFrom": [
"problem_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"flowchart_submission_user_id_225c83e8_fk_user_id": {
"name": "flowchart_submission_user_id_225c83e8_fk_user_id",
"tableFrom": "flowchart_submission",
"tableTo": "user",
"schemaTo": "public",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.message": {
"name": "message",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "byDefault",
"name": "message_id_seq",
"increment": "1",
"minValue": "1",
"maxValue": "2147483647",
"startWith": "1",
"cache": "1",
"cycle": false,
"schema": "public"
}
},
"message": {
"name": "message",
"type": "text",
"primaryKey": false,
"notNull": true
},
"create_time": {
"name": "create_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"recipient_id": {
"name": "recipient_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"sender_id": {
"name": "sender_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"submission_id": {
"name": "submission_id",
"type": "text",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"message_recipient_id_2aa5dd76": {
"name": "message_recipient_id_2aa5dd76",
"columns": [
{
"expression": "recipient_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"message_recipient_time_idx": {
"name": "message_recipient_time_idx",
"columns": [
{
"expression": "recipient_id",
"asc": true,
"nulls": "last",
"opclass": "timestamptz_ops",
"isExpression": false
},
{
"expression": "create_time",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"message_sender_id_a2a2e825": {
"name": "message_sender_id_a2a2e825",
"columns": [
{
"expression": "sender_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"message_submission_id_2fdf8a47": {
"name": "message_submission_id_2fdf8a47",
"columns": [
{
"expression": "submission_id",
"asc": true,
"nulls": "last",
"opclass": "text_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"message_submission_id_2fdf8a47_like": {
"name": "message_submission_id_2fdf8a47_like",
"columns": [
{
"expression": "submission_id",
"asc": true,
"nulls": "last",
"opclass": "text_pattern_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"message_recipient_id_2aa5dd76_fk_user_id": {
"name": "message_recipient_id_2aa5dd76_fk_user_id",
"tableFrom": "message",
"tableTo": "user",
"schemaTo": "public",
"columnsFrom": [
"recipient_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"message_sender_id_a2a2e825_fk_user_id": {
"name": "message_sender_id_a2a2e825_fk_user_id",
"tableFrom": "message",
"tableTo": "user",
"schemaTo": "public",
"columnsFrom": [
"sender_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"message_submission_id_2fdf8a47_fk_submission_id": {
"name": "message_submission_id_2fdf8a47_fk_submission_id",
"tableFrom": "message",
"tableTo": "submission",
"schemaTo": "public",
"columnsFrom": [
"submission_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.judge_server": {
"name": "judge_server",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"hostname": {
"name": "hostname",
"type": "text",
"primaryKey": false,
"notNull": true
},
"ip": {
"name": "ip",
"type": "text",
"primaryKey": false,
"notNull": false
},
"judger_version": {
"name": "judger_version",
"type": "text",
"primaryKey": false,
"notNull": true
},
"cpu_core": {
"name": "cpu_core",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"memory_usage": {
"name": "memory_usage",
"type": "double precision",
"primaryKey": false,
"notNull": true
},
"cpu_usage": {
"name": "cpu_usage",
"type": "double precision",
"primaryKey": false,
"notNull": true
},
"last_heartbeat": {
"name": "last_heartbeat",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"create_time": {
"name": "create_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"task_number": {
"name": "task_number",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"service_url": {
"name": "service_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_disabled": {
"name": "is_disabled",
"type": "boolean",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.exercise": {
"name": "exercise",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "byDefault",
"name": "exercise_id_seq",
"increment": "1",
"minValue": "1",
"maxValue": "2147483647",
"startWith": "1",
"cache": "1",
"cycle": false,
"schema": "public"
}
},
"type": {
"name": "type",
"type": "varchar(16)",
"primaryKey": false,
"notNull": true
},
"data": {
"name": "data",
"type": "jsonb",
"primaryKey": false,
"notNull": true
},
"order": {
"name": "order",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"tutorial_id": {
"name": "tutorial_id",
"type": "integer",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"exercise_tutorial_id_6fd04055": {
"name": "exercise_tutorial_id_6fd04055",
"columns": [
{
"expression": "tutorial_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"exercise_tutorial_id_6fd04055_fk_tutorial_id": {
"name": "exercise_tutorial_id_6fd04055_fk_tutorial_id",
"tableFrom": "exercise",
"tableTo": "tutorial",
"schemaTo": "public",
"columnsFrom": [
"tutorial_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.options_sysoptions": {
"name": "options_sysoptions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"key": {
"name": "key",
"type": "text",
"primaryKey": false,
"notNull": true
},
"value": {
"name": "value",
"type": "jsonb",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"options_sysoptions_key_key": {
"columns": [
"key"
],
"nullsNotDistinct": false,
"name": "options_sysoptions_key_key"
}
},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.problemset": {
"name": "problemset",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "bigint",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "byDefault",
"name": "problemset_id_seq",
"increment": "1",
"minValue": "1",
"maxValue": "9223372036854775807",
"startWith": "1",
"cache": "1",
"cycle": false,
"schema": "public"
}
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": true
},
"create_time": {
"name": "create_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"last_update_time": {
"name": "last_update_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"visible": {
"name": "visible",
"type": "boolean",
"primaryKey": false,
"notNull": true
},
"difficulty": {
"name": "difficulty",
"type": "text",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true
},
"created_by_id": {
"name": "created_by_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"end_time": {
"name": "end_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
}
},
"indexes": {
"problemset_created_by_id_01b5197f": {
"name": "problemset_created_by_id_01b5197f",
"columns": [
{
"expression": "created_by_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"problemset_created_by_id_01b5197f_fk_user_id": {
"name": "problemset_created_by_id_01b5197f_fk_user_id",
"tableFrom": "problemset",
"tableTo": "user",
"schemaTo": "public",
"columnsFrom": [
"created_by_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.problemset_problem": {
"name": "problemset_problem",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "bigint",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "byDefault",
"name": "problemset_problem_id_seq",
"increment": "1",
"minValue": "1",
"maxValue": "9223372036854775807",
"startWith": "1",
"cache": "1",
"cycle": false,
"schema": "public"
}
},
"order": {
"name": "order",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"is_required": {
"name": "is_required",
"type": "boolean",
"primaryKey": false,
"notNull": true
},
"score": {
"name": "score",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"hint": {
"name": "hint",
"type": "text",
"primaryKey": false,
"notNull": false
},
"problem_id": {
"name": "problem_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"problemset_id": {
"name": "problemset_id",
"type": "bigint",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"problemset_problem_problem_id_fff2d686": {
"name": "problemset_problem_problem_id_fff2d686",
"columns": [
{
"expression": "problem_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"problemset_problem_problemset_id_350d17fb": {
"name": "problemset_problem_problemset_id_350d17fb",
"columns": [
{
"expression": "problemset_id",
"asc": true,
"nulls": "last",
"opclass": "int8_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"problemset_problem_problem_id_fff2d686_fk_problem_id": {
"name": "problemset_problem_problem_id_fff2d686_fk_problem_id",
"tableFrom": "problemset_problem",
"tableTo": "problem",
"schemaTo": "public",
"columnsFrom": [
"problem_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"problemset_problem_problemset_id_350d17fb_fk_problemset_id": {
"name": "problemset_problem_problemset_id_350d17fb_fk_problemset_id",
"tableFrom": "problemset_problem",
"tableTo": "problemset",
"schemaTo": "public",
"columnsFrom": [
"problemset_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"unique_problemset_problem": {
"columns": [
"problem_id",
"problemset_id"
],
"nullsNotDistinct": false,
"name": "unique_problemset_problem"
}
},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.problemset_progress": {
"name": "problemset_progress",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "bigint",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "byDefault",
"name": "problemset_progress_id_seq",
"increment": "1",
"minValue": "1",
"maxValue": "9223372036854775807",
"startWith": "1",
"cache": "1",
"cycle": false,
"schema": "public"
}
},
"join_time": {
"name": "join_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"complete_time": {
"name": "complete_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"is_completed": {
"name": "is_completed",
"type": "boolean",
"primaryKey": false,
"notNull": true
},
"progress_percentage": {
"name": "progress_percentage",
"type": "double precision",
"primaryKey": false,
"notNull": true
},
"completed_problems_count": {
"name": "completed_problems_count",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"total_problems_count": {
"name": "total_problems_count",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"total_score": {
"name": "total_score",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"progress_detail": {
"name": "progress_detail",
"type": "jsonb",
"primaryKey": false,
"notNull": true
},
"problemset_id": {
"name": "problemset_id",
"type": "bigint",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"problemset_progress_problemset_id_20a9632e": {
"name": "problemset_progress_problemset_id_20a9632e",
"columns": [
{
"expression": "problemset_id",
"asc": true,
"nulls": "last",
"opclass": "int8_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"problemset_progress_user_id_c8041a80": {
"name": "problemset_progress_user_id_c8041a80",
"columns": [
{
"expression": "user_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"problemset_progress_problemset_id_20a9632e_fk_problemset_id": {
"name": "problemset_progress_problemset_id_20a9632e_fk_problemset_id",
"tableFrom": "problemset_progress",
"tableTo": "problemset",
"schemaTo": "public",
"columnsFrom": [
"problemset_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"problemset_progress_user_id_c8041a80_fk_user_id": {
"name": "problemset_progress_user_id_c8041a80_fk_user_id",
"tableFrom": "problemset_progress",
"tableTo": "user",
"schemaTo": "public",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"unique_problemset_progress_user": {
"columns": [
"problemset_id",
"user_id"
],
"nullsNotDistinct": false,
"name": "unique_problemset_progress_user"
}
},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.problemset_submission": {
"name": "problemset_submission",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "bigint",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "byDefault",
"name": "problemset_submission_id_seq",
"increment": "1",
"minValue": "1",
"maxValue": "9223372036854775807",
"startWith": "1",
"cache": "1",
"cycle": false,
"schema": "public"
}
},
"problem_id": {
"name": "problem_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"problemset_id": {
"name": "problemset_id",
"type": "bigint",
"primaryKey": false,
"notNull": true
},
"submission_id": {
"name": "submission_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"problemset__problem_1f39fa_idx": {
"name": "problemset__problem_1f39fa_idx",
"columns": [
{
"expression": "problemset_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
},
{
"expression": "user_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"problemset__problem_22f053_idx": {
"name": "problemset__problem_22f053_idx",
"columns": [
{
"expression": "problemset_id",
"asc": true,
"nulls": "last",
"opclass": "int8_ops",
"isExpression": false
},
{
"expression": "problem_id",
"asc": true,
"nulls": "last",
"opclass": "int8_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"problemset__user_id_2f1501_idx": {
"name": "problemset__user_id_2f1501_idx",
"columns": [
{
"expression": "user_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"problemset_submission_problem_id_5629b105": {
"name": "problemset_submission_problem_id_5629b105",
"columns": [
{
"expression": "problem_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"problemset_submission_problemset_id_85290e17": {
"name": "problemset_submission_problemset_id_85290e17",
"columns": [
{
"expression": "problemset_id",
"asc": true,
"nulls": "last",
"opclass": "int8_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"problemset_submission_submission_id_78e2b807": {
"name": "problemset_submission_submission_id_78e2b807",
"columns": [
{
"expression": "submission_id",
"asc": true,
"nulls": "last",
"opclass": "text_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"problemset_submission_submission_id_78e2b807_like": {
"name": "problemset_submission_submission_id_78e2b807_like",
"columns": [
{
"expression": "submission_id",
"asc": true,
"nulls": "last",
"opclass": "text_pattern_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"problemset_submission_user_id_915fc9c6": {
"name": "problemset_submission_user_id_915fc9c6",
"columns": [
{
"expression": "user_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"problemset_submission_problem_id_5629b105_fk_problem_id": {
"name": "problemset_submission_problem_id_5629b105_fk_problem_id",
"tableFrom": "problemset_submission",
"tableTo": "problem",
"schemaTo": "public",
"columnsFrom": [
"problem_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"problemset_submission_problemset_id_85290e17_fk_problemset_id": {
"name": "problemset_submission_problemset_id_85290e17_fk_problemset_id",
"tableFrom": "problemset_submission",
"tableTo": "problemset",
"schemaTo": "public",
"columnsFrom": [
"problemset_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"problemset_submission_submission_id_78e2b807_fk_submission_id": {
"name": "problemset_submission_submission_id_78e2b807_fk_submission_id",
"tableFrom": "problemset_submission",
"tableTo": "submission",
"schemaTo": "public",
"columnsFrom": [
"submission_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"problemset_submission_user_id_915fc9c6_fk_user_id": {
"name": "problemset_submission_user_id_915fc9c6_fk_user_id",
"tableFrom": "problemset_submission",
"tableTo": "user",
"schemaTo": "public",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.reaction": {
"name": "reaction",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "byDefault",
"name": "reaction_id_seq",
"increment": "1",
"minValue": "1",
"maxValue": "2147483647",
"startWith": "1",
"cache": "1",
"cycle": false,
"schema": "public"
}
},
"type": {
"name": "type",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"create_time": {
"name": "create_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"problem_id": {
"name": "problem_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"reaction_problem_id_a7f3b9f3": {
"name": "reaction_problem_id_a7f3b9f3",
"columns": [
{
"expression": "problem_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"reaction_problem_type_idx": {
"name": "reaction_problem_type_idx",
"columns": [
{
"expression": "problem_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
},
{
"expression": "type",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"reaction_user_id_cfa7f469": {
"name": "reaction_user_id_cfa7f469",
"columns": [
{
"expression": "user_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"reaction_problem_id_a7f3b9f3_fk_problem_id": {
"name": "reaction_problem_id_a7f3b9f3_fk_problem_id",
"tableFrom": "reaction",
"tableTo": "problem",
"schemaTo": "public",
"columnsFrom": [
"problem_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"reaction_user_id_cfa7f469_fk_user_id": {
"name": "reaction_user_id_cfa7f469_fk_user_id",
"tableFrom": "reaction",
"tableTo": "user",
"schemaTo": "public",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"reaction_problem_user_unique": {
"columns": [
"problem_id",
"user_id"
],
"nullsNotDistinct": false,
"name": "reaction_problem_user_unique"
}
},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.problem": {
"name": "problem",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": true
},
"input_description": {
"name": "input_description",
"type": "text",
"primaryKey": false,
"notNull": true
},
"output_description": {
"name": "output_description",
"type": "text",
"primaryKey": false,
"notNull": true
},
"samples": {
"name": "samples",
"type": "jsonb",
"primaryKey": false,
"notNull": true
},
"test_case_id": {
"name": "test_case_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"test_case_score": {
"name": "test_case_score",
"type": "jsonb",
"primaryKey": false,
"notNull": true
},
"hint": {
"name": "hint",
"type": "text",
"primaryKey": false,
"notNull": false
},
"languages": {
"name": "languages",
"type": "jsonb",
"primaryKey": false,
"notNull": true
},
"template": {
"name": "template",
"type": "jsonb",
"primaryKey": false,
"notNull": true
},
"create_time": {
"name": "create_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"last_update_time": {
"name": "last_update_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"time_limit": {
"name": "time_limit",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"memory_limit": {
"name": "memory_limit",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"visible": {
"name": "visible",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"difficulty": {
"name": "difficulty",
"type": "text",
"primaryKey": false,
"notNull": true
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": false
},
"submission_number": {
"name": "submission_number",
"type": "bigint",
"primaryKey": false,
"notNull": true,
"default": 0
},
"accepted_number": {
"name": "accepted_number",
"type": "bigint",
"primaryKey": false,
"notNull": true,
"default": 0
},
"created_by_id": {
"name": "created_by_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"_id": {
"name": "_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"statistic_info": {
"name": "statistic_info",
"type": "jsonb",
"primaryKey": false,
"notNull": true,
"default": "'{}'::jsonb"
},
"contest_id": {
"name": "contest_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"is_public": {
"name": "is_public",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"share_submission": {
"name": "share_submission",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"prompt": {
"name": "prompt",
"type": "text",
"primaryKey": false,
"notNull": false
},
"answers": {
"name": "answers",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"allow_flowchart": {
"name": "allow_flowchart",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"flowchart_data": {
"name": "flowchart_data",
"type": "jsonb",
"primaryKey": false,
"notNull": true,
"default": "'{}'::jsonb"
},
"flowchart_hint": {
"name": "flowchart_hint",
"type": "text",
"primaryKey": false,
"notNull": false
},
"mermaid_code": {
"name": "mermaid_code",
"type": "text",
"primaryKey": false,
"notNull": false
},
"show_flowchart": {
"name": "show_flowchart",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"ast_rules": {
"name": "ast_rules",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"sql_config": {
"name": "sql_config",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"sql_display": {
"name": "sql_display",
"type": "jsonb",
"primaryKey": false,
"notNull": false
}
},
"indexes": {
"problem__id_919b1d80": {
"name": "problem__id_919b1d80",
"columns": [
{
"expression": "_id",
"asc": true,
"nulls": "last",
"opclass": "text_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"problem_contest_id_328e013a": {
"name": "problem_contest_id_328e013a",
"columns": [
{
"expression": "contest_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"problem_contest_visible_idx": {
"name": "problem_contest_visible_idx",
"columns": [
{
"expression": "contest_id",
"asc": true,
"nulls": "last",
"opclass": "bool_ops",
"isExpression": false
},
{
"expression": "visible",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"problem_created_by_id_cb362143": {
"name": "problem_created_by_id_cb362143",
"columns": [
{
"expression": "created_by_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"problem_visible_idx": {
"name": "problem_visible_idx",
"columns": [
{
"expression": "visible",
"asc": true,
"nulls": "last",
"opclass": "bool_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"problem_contest_id_328e013a_fk_contest_id": {
"name": "problem_contest_id_328e013a_fk_contest_id",
"tableFrom": "problem",
"tableTo": "contest",
"schemaTo": "public",
"columnsFrom": [
"contest_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"problem_created_by_id_cb362143_fk_user_id": {
"name": "problem_created_by_id_cb362143_fk_user_id",
"tableFrom": "problem",
"tableTo": "user",
"schemaTo": "public",
"columnsFrom": [
"created_by_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"unique_problem_id_contest": {
"columns": [
"_id",
"contest_id"
],
"nullsNotDistinct": false,
"name": "unique_problem_id_contest"
}
},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.problem_tags": {
"name": "problem_tags",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"problem_id": {
"name": "problem_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"problemtag_id": {
"name": "problemtag_id",
"type": "integer",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"problem_tags_problem_id_866ecb8d": {
"name": "problem_tags_problem_id_866ecb8d",
"columns": [
{
"expression": "problem_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"problem_tags_problemtag_id_72d20571": {
"name": "problem_tags_problemtag_id_72d20571",
"columns": [
{
"expression": "problemtag_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"problem_tags_problem_id_866ecb8d_fk_problem_id": {
"name": "problem_tags_problem_id_866ecb8d_fk_problem_id",
"tableFrom": "problem_tags",
"tableTo": "problem",
"schemaTo": "public",
"columnsFrom": [
"problem_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"problem_tags_problemtag_id_72d20571_fk_problem_tag_id": {
"name": "problem_tags_problemtag_id_72d20571_fk_problem_tag_id",
"tableFrom": "problem_tags",
"tableTo": "problem_tag",
"schemaTo": "public",
"columnsFrom": [
"problemtag_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"problem_tags_problem_id_problemtag_id_318459d1_uniq": {
"columns": [
"problem_id",
"problemtag_id"
],
"nullsNotDistinct": false,
"name": "problem_tags_problem_id_problemtag_id_318459d1_uniq"
}
},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.problem_tag": {
"name": "problem_tag",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"problem_tag_name_ci_unique": {
"name": "problem_tag_name_ci_unique",
"columns": [
{
"expression": "lower(name)",
"asc": true,
"nulls": "last",
"isExpression": true
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.submission": {
"name": "submission",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"contest_id": {
"name": "contest_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"problem_id": {
"name": "problem_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"create_time": {
"name": "create_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"code": {
"name": "code",
"type": "text",
"primaryKey": false,
"notNull": true
},
"result": {
"name": "result",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 6
},
"info": {
"name": "info",
"type": "jsonb",
"primaryKey": false,
"notNull": true,
"default": "'{}'::jsonb"
},
"language": {
"name": "language",
"type": "text",
"primaryKey": false,
"notNull": true
},
"shared": {
"name": "shared",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"statistic_info": {
"name": "statistic_info",
"type": "jsonb",
"primaryKey": false,
"notNull": true,
"default": "'{}'::jsonb"
},
"username": {
"name": "username",
"type": "text",
"primaryKey": false,
"notNull": true
},
"ip": {
"name": "ip",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {
"contest_create_time_idx": {
"name": "contest_create_time_idx",
"columns": [
{
"expression": "contest_id",
"asc": true,
"nulls": "last",
"opclass": "timestamptz_ops",
"isExpression": false
},
{
"expression": "create_time",
"asc": false,
"nulls": "first",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"problem_user_idx": {
"name": "problem_user_idx",
"columns": [
{
"expression": "problem_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
},
{
"expression": "user_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"submission_contest_id_775716d5": {
"name": "submission_contest_id_775716d5",
"columns": [
{
"expression": "contest_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"submission_problem_id_76847b55": {
"name": "submission_problem_id_76847b55",
"columns": [
{
"expression": "problem_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"submission_result_37e2f67a": {
"name": "submission_result_37e2f67a",
"columns": [
{
"expression": "result",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"submission_user_id_3779a8c1": {
"name": "submission_user_id_3779a8c1",
"columns": [
{
"expression": "user_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"user_create_time_idx": {
"name": "user_create_time_idx",
"columns": [
{
"expression": "user_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
},
{
"expression": "create_time",
"asc": true,
"nulls": "last",
"opclass": "timestamptz_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"submission_contest_id_775716d5_fk_contest_id": {
"name": "submission_contest_id_775716d5_fk_contest_id",
"tableFrom": "submission",
"tableTo": "contest",
"schemaTo": "public",
"columnsFrom": [
"contest_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"submission_problem_id_76847b55_fk_problem_id": {
"name": "submission_problem_id_76847b55_fk_problem_id",
"tableFrom": "submission",
"tableTo": "problem",
"schemaTo": "public",
"columnsFrom": [
"problem_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.tutorial": {
"name": "tutorial",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "byDefault",
"name": "tutorial_id_seq",
"increment": "1",
"minValue": "1",
"maxValue": "2147483647",
"startWith": "1",
"cache": "1",
"cycle": false,
"schema": "public"
}
},
"title": {
"name": "title",
"type": "varchar(128)",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"is_public": {
"name": "is_public",
"type": "boolean",
"primaryKey": false,
"notNull": true
},
"order": {
"name": "order",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"created_by_id": {
"name": "created_by_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"code": {
"name": "code",
"type": "text",
"primaryKey": false,
"notNull": false
},
"type": {
"name": "type",
"type": "varchar(10)",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"tutorial_created_by_id_07973cab": {
"name": "tutorial_created_by_id_07973cab",
"columns": [
{
"expression": "created_by_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"tutorial_created_by_id_07973cab_fk_user_id": {
"name": "tutorial_created_by_id_07973cab_fk_user_id",
"tableFrom": "tutorial",
"tableTo": "user",
"schemaTo": "public",
"columnsFrom": [
"created_by_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.user_stat": {
"name": "user_stat",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "bigint",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "byDefault",
"name": "user_stat_id_seq",
"increment": "1",
"minValue": "1",
"maxValue": "9223372036854775807",
"startWith": "1",
"cache": "1",
"cycle": false,
"schema": "public"
}
},
"metrics": {
"name": "metrics",
"type": "jsonb",
"primaryKey": false,
"notNull": true,
"default": "'{}'::jsonb"
},
"update_time": {
"name": "update_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"user_stat_user_id_73337fc0_fk_user_id": {
"name": "user_stat_user_id_73337fc0_fk_user_id",
"tableFrom": "user_stat",
"tableTo": "user",
"schemaTo": "public",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"user_stat_user_id_key": {
"columns": [
"user_id"
],
"nullsNotDistinct": false,
"name": "user_stat_user_id_key"
}
},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.user_achievement": {
"name": "user_achievement",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "bigint",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "byDefault",
"name": "user_achievement_id_seq",
"increment": "1",
"minValue": "1",
"maxValue": "9223372036854775807",
"startWith": "1",
"cache": "1",
"cycle": false,
"schema": "public"
}
},
"unlock_time": {
"name": "unlock_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"backfilled": {
"name": "backfilled",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"notified": {
"name": "notified",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"achievement_id": {
"name": "achievement_id",
"type": "bigint",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"user_achievement_achievement_id_29db600d": {
"name": "user_achievement_achievement_id_29db600d",
"columns": [
{
"expression": "achievement_id",
"asc": true,
"nulls": "last",
"opclass": "int8_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"user_achievement_user_id_b8ec7d6a": {
"name": "user_achievement_user_id_b8ec7d6a",
"columns": [
{
"expression": "user_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"user_achv_notified_idx": {
"name": "user_achv_notified_idx",
"columns": [
{
"expression": "user_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
},
{
"expression": "notified",
"asc": true,
"nulls": "last",
"opclass": "bool_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"user_achv_time_idx": {
"name": "user_achv_time_idx",
"columns": [
{
"expression": "user_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
},
{
"expression": "unlock_time",
"asc": false,
"nulls": "first",
"opclass": "timestamptz_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"user_achievement_achievement_id_29db600d_fk_achievement_id": {
"name": "user_achievement_achievement_id_29db600d_fk_achievement_id",
"tableFrom": "user_achievement",
"tableTo": "achievement",
"schemaTo": "public",
"columnsFrom": [
"achievement_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"user_achievement_user_id_b8ec7d6a_fk_user_id": {
"name": "user_achievement_user_id_b8ec7d6a_fk_user_id",
"tableFrom": "user_achievement",
"tableTo": "user",
"schemaTo": "public",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"unique_user_achievement": {
"columns": [
"achievement_id",
"user_id"
],
"nullsNotDistinct": false,
"name": "unique_user_achievement"
}
},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.user_badge": {
"name": "user_badge",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "bigint",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "byDefault",
"name": "user_badge_id_seq",
"increment": "1",
"minValue": "1",
"maxValue": "9223372036854775807",
"startWith": "1",
"cache": "1",
"cycle": false,
"schema": "public"
}
},
"earned_time": {
"name": "earned_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"badge_id": {
"name": "badge_id",
"type": "bigint",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"user_badge_badge_id_92a983e9": {
"name": "user_badge_badge_id_92a983e9",
"columns": [
{
"expression": "badge_id",
"asc": true,
"nulls": "last",
"opclass": "int8_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"user_badge_user_id_a286d718": {
"name": "user_badge_user_id_a286d718",
"columns": [
{
"expression": "user_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"user_badge_badge_id_92a983e9_fk_problemset_badge_id": {
"name": "user_badge_badge_id_92a983e9_fk_problemset_badge_id",
"tableFrom": "user_badge",
"tableTo": "problemset_badge",
"schemaTo": "public",
"columnsFrom": [
"badge_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"user_badge_user_id_a286d718_fk_user_id": {
"name": "user_badge_user_id_a286d718_fk_user_id",
"tableFrom": "user_badge",
"tableTo": "user",
"schemaTo": "public",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"unique_user_badge": {
"columns": [
"badge_id",
"user_id"
],
"nullsNotDistinct": false,
"name": "unique_user_badge"
}
},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.user_profile": {
"name": "user_profile",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"acm_problems_status": {
"name": "acm_problems_status",
"type": "jsonb",
"primaryKey": false,
"notNull": true,
"default": "'{}'::jsonb"
},
"avatar": {
"name": "avatar",
"type": "text",
"primaryKey": false,
"notNull": true
},
"blog": {
"name": "blog",
"type": "varchar(200)",
"primaryKey": false,
"notNull": false
},
"mood": {
"name": "mood",
"type": "text",
"primaryKey": false,
"notNull": false
},
"accepted_number": {
"name": "accepted_number",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"submission_number": {
"name": "submission_number",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"github": {
"name": "github",
"type": "text",
"primaryKey": false,
"notNull": false
},
"school": {
"name": "school",
"type": "text",
"primaryKey": false,
"notNull": false
},
"major": {
"name": "major",
"type": "text",
"primaryKey": false,
"notNull": false
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"real_name": {
"name": "real_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"language": {
"name": "language",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"user_profile_user_id_8fdce8e2_fk_user_id": {
"name": "user_profile_user_id_8fdce8e2_fk_user_id",
"tableFrom": "user_profile",
"tableTo": "user",
"schemaTo": "public",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"user_profile_user_id_key": {
"columns": [
"user_id"
],
"nullsNotDistinct": false,
"name": "user_profile_user_id_key"
}
},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.acm_contest_rank": {
"name": "acm_contest_rank",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"submission_number": {
"name": "submission_number",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"accepted_number": {
"name": "accepted_number",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"total_time": {
"name": "total_time",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"submission_info": {
"name": "submission_info",
"type": "jsonb",
"primaryKey": false,
"notNull": true,
"default": "'{}'::jsonb"
},
"contest_id": {
"name": "contest_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"acm_contest_rank_contest_id_21030ccd": {
"name": "acm_contest_rank_contest_id_21030ccd",
"columns": [
{
"expression": "contest_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"acm_contest_rank_user_id_40391ab2": {
"name": "acm_contest_rank_user_id_40391ab2",
"columns": [
{
"expression": "user_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"acm_rank_contest_user_idx": {
"name": "acm_rank_contest_user_idx",
"columns": [
{
"expression": "contest_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
},
{
"expression": "user_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"acm_rank_order_idx": {
"name": "acm_rank_order_idx",
"columns": [
{
"expression": "contest_id",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
},
{
"expression": "accepted_number",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
},
{
"expression": "total_time",
"asc": true,
"nulls": "last",
"opclass": "int4_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"acm_contest_rank_contest_id_21030ccd_fk_contest_id": {
"name": "acm_contest_rank_contest_id_21030ccd_fk_contest_id",
"tableFrom": "acm_contest_rank",
"tableTo": "contest",
"schemaTo": "public",
"columnsFrom": [
"contest_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"acm_contest_rank_user_id_40391ab2_fk_user_id": {
"name": "acm_contest_rank_user_id_40391ab2_fk_user_id",
"tableFrom": "acm_contest_rank",
"tableTo": "user",
"schemaTo": "public",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"unique_acm_rank_user_contest": {
"columns": [
"contest_id",
"user_id"
],
"nullsNotDistinct": false,
"name": "unique_acm_rank_user_contest"
}
},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.user": {
"name": "user",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"password": {
"name": "password",
"type": "varchar(128)",
"primaryKey": false,
"notNull": true
},
"last_login": {
"name": "last_login",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"username": {
"name": "username",
"type": "text",
"primaryKey": false,
"notNull": true
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"create_time": {
"name": "create_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"admin_type": {
"name": "admin_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"auth_token": {
"name": "auth_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"open_api": {
"name": "open_api",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"open_api_appkey": {
"name": "open_api_appkey",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_disabled": {
"name": "is_disabled",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"problem_permission": {
"name": "problem_permission",
"type": "text",
"primaryKey": false,
"notNull": true
},
"session_keys": {
"name": "session_keys",
"type": "jsonb",
"primaryKey": false,
"notNull": true,
"default": "'[]'::jsonb"
},
"raw_password": {
"name": "raw_password",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"class_name": {
"name": "class_name",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"user_username_key": {
"columns": [
"username"
],
"nullsNotDistinct": false,
"name": "user_username_key"
}
},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
},
"public.problemset_badge": {
"name": "problemset_badge",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "bigint",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "byDefault",
"name": "problemset_badge_id_seq",
"increment": "1",
"minValue": "1",
"maxValue": "9223372036854775807",
"startWith": "1",
"cache": "1",
"cycle": false,
"schema": "public"
}
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": true
},
"icon": {
"name": "icon",
"type": "text",
"primaryKey": false,
"notNull": true
},
"condition_type": {
"name": "condition_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"condition_value": {
"name": "condition_value",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"problemset_id": {
"name": "problemset_id",
"type": "bigint",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"problemset_badge_problemset_id_6cb6c74f": {
"name": "problemset_badge_problemset_id_6cb6c74f",
"columns": [
{
"expression": "problemset_id",
"asc": true,
"nulls": "last",
"opclass": "int8_ops",
"isExpression": false
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"problemset_badge_problemset_id_6cb6c74f_fk_problemset_id": {
"name": "problemset_badge_problemset_id_6cb6c74f_fk_problemset_id",
"tableFrom": "problemset_badge",
"tableTo": "problemset",
"schemaTo": "public",
"columnsFrom": [
"problemset_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {},
"policies": {},
"isRLSEnabled": false
}
},
"enums": {},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
},
"internal": {
"tables": {}
}
}