1412 lines
36 KiB
JSON
1412 lines
36 KiB
JSON
{
|
|
"version": "5",
|
|
"dialect": "mysql",
|
|
"id": "5bab5fce-302f-485a-a496-e4deeafc2269",
|
|
"prevId": "6c0dff68-1942-488f-9b33-67bb739dee2b",
|
|
"tables": {
|
|
"achievements": {
|
|
"name": "achievements",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"type": {
|
|
"name": "type",
|
|
"type": "enum('knowledge','behavior')",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"name": {
|
|
"name": "name",
|
|
"type": "varchar(100)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"description": {
|
|
"name": "description",
|
|
"type": "varchar(300)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"icon_url": {
|
|
"name": "icon_url",
|
|
"type": "varchar(500)",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"condition": {
|
|
"name": "condition",
|
|
"type": "json",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "CURRENT_TIMESTAMP"
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {
|
|
"achievements_id": {
|
|
"name": "achievements_id",
|
|
"columns": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"checkConstraint": {}
|
|
},
|
|
"admin_audit_log": {
|
|
"name": "admin_audit_log",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": true
|
|
},
|
|
"admin_id": {
|
|
"name": "admin_id",
|
|
"type": "varchar(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"action": {
|
|
"name": "action",
|
|
"type": "varchar(10)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"resource": {
|
|
"name": "resource",
|
|
"type": "varchar(500)",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"details": {
|
|
"name": "details",
|
|
"type": "json",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"ip_address": {
|
|
"name": "ip_address",
|
|
"type": "varchar(45)",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "CURRENT_TIMESTAMP"
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {
|
|
"admin_audit_log_id": {
|
|
"name": "admin_audit_log_id",
|
|
"columns": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"checkConstraint": {}
|
|
},
|
|
"admin_users": {
|
|
"name": "admin_users",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"type": "varchar(50)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"password_hash": {
|
|
"name": "password_hash",
|
|
"type": "varchar(255)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"role": {
|
|
"name": "role",
|
|
"type": "enum('admin','super_admin')",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "'admin'"
|
|
},
|
|
"is_active": {
|
|
"name": "is_active",
|
|
"type": "tinyint",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": 1
|
|
},
|
|
"last_login_at": {
|
|
"name": "last_login_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "CURRENT_TIMESTAMP"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"uk_admin_username": {
|
|
"name": "uk_admin_username",
|
|
"columns": [
|
|
"username"
|
|
],
|
|
"isUnique": true
|
|
}
|
|
},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {
|
|
"admin_users_id": {
|
|
"name": "admin_users_id",
|
|
"columns": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"checkConstraint": {}
|
|
},
|
|
"categories": {
|
|
"name": "categories",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "varchar(50)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"name": {
|
|
"name": "name",
|
|
"type": "varchar(100)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"slug": {
|
|
"name": "slug",
|
|
"type": "varchar(100)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"parent_id": {
|
|
"name": "parent_id",
|
|
"type": "varchar(50)",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"sort_order": {
|
|
"name": "sort_order",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": 0
|
|
},
|
|
"question_count": {
|
|
"name": "question_count",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": 0
|
|
},
|
|
"status": {
|
|
"name": "status",
|
|
"type": "enum('active','inactive')",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "'active'"
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "CURRENT_TIMESTAMP"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"uk_slug": {
|
|
"name": "uk_slug",
|
|
"columns": [
|
|
"slug"
|
|
],
|
|
"isUnique": true
|
|
}
|
|
},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {
|
|
"categories_id": {
|
|
"name": "categories_id",
|
|
"columns": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"checkConstraint": {}
|
|
},
|
|
"knowledge_cards": {
|
|
"name": "knowledge_cards",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"question_id": {
|
|
"name": "question_id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"summary": {
|
|
"name": "summary",
|
|
"type": "varchar(300)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"deep_dive": {
|
|
"name": "deep_dive",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"source_ref": {
|
|
"name": "source_ref",
|
|
"type": "varchar(500)",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "CURRENT_TIMESTAMP"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"uk_question": {
|
|
"name": "uk_question",
|
|
"columns": [
|
|
"question_id"
|
|
],
|
|
"isUnique": true
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"knowledge_cards_question_id_questions_id_fk": {
|
|
"name": "knowledge_cards_question_id_questions_id_fk",
|
|
"tableFrom": "knowledge_cards",
|
|
"tableTo": "questions",
|
|
"columnsFrom": [
|
|
"question_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "no action",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {
|
|
"knowledge_cards_id": {
|
|
"name": "knowledge_cards_id",
|
|
"columns": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"checkConstraint": {}
|
|
},
|
|
"leaderboard_snapshots": {
|
|
"name": "leaderboard_snapshots",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"tier": {
|
|
"name": "tier",
|
|
"type": "enum('bronze','silver','gold','platinum','diamond','master','grandmaster','champion','legend','mythic')",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"weekly_xp": {
|
|
"name": "weekly_xp",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": 0
|
|
},
|
|
"rank": {
|
|
"name": "rank",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"league": {
|
|
"name": "league",
|
|
"type": "varchar(50)",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"week_start": {
|
|
"name": "week_start",
|
|
"type": "date",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"week_end": {
|
|
"name": "week_end",
|
|
"type": "date",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "CURRENT_TIMESTAMP"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"idx_user_week": {
|
|
"name": "idx_user_week",
|
|
"columns": [
|
|
"user_id",
|
|
"week_start"
|
|
],
|
|
"isUnique": false
|
|
}
|
|
},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {
|
|
"leaderboard_snapshots_id": {
|
|
"name": "leaderboard_snapshots_id",
|
|
"columns": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"checkConstraint": {}
|
|
},
|
|
"question_ratings": {
|
|
"name": "question_ratings",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"question_id": {
|
|
"name": "question_id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"rating": {
|
|
"name": "rating",
|
|
"type": "enum('good','bad')",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "CURRENT_TIMESTAMP"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"uk_user_question_rating": {
|
|
"name": "uk_user_question_rating",
|
|
"columns": [
|
|
"user_id",
|
|
"question_id"
|
|
],
|
|
"isUnique": true
|
|
}
|
|
},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {
|
|
"question_ratings_id": {
|
|
"name": "question_ratings_id",
|
|
"columns": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"checkConstraint": {}
|
|
},
|
|
"questions": {
|
|
"name": "questions",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"stem": {
|
|
"name": "stem",
|
|
"type": "json",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"content_type": {
|
|
"name": "content_type",
|
|
"type": "enum('text','image','video','audio')",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"correct_answer": {
|
|
"name": "correct_answer",
|
|
"type": "varchar(500)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"distractors": {
|
|
"name": "distractors",
|
|
"type": "json",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"category_id": {
|
|
"name": "category_id",
|
|
"type": "varchar(50)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"difficulty": {
|
|
"name": "difficulty",
|
|
"type": "tinyint",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"dynamic_difficulty": {
|
|
"name": "dynamic_difficulty",
|
|
"type": "decimal(3,1)",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"source": {
|
|
"name": "source",
|
|
"type": "enum('system','ugc')",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "'system'"
|
|
},
|
|
"creator_id": {
|
|
"name": "creator_id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"status": {
|
|
"name": "status",
|
|
"type": "enum('draft','reviewing','published','archived')",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "'draft'"
|
|
},
|
|
"stats": {
|
|
"name": "stats",
|
|
"type": "json",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "('{\"timesAnswered\":0,\"correctRate\":0,\"avgTimeMs\":0}')"
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "CURRENT_TIMESTAMP"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {
|
|
"questions_category_id_categories_id_fk": {
|
|
"name": "questions_category_id_categories_id_fk",
|
|
"tableFrom": "questions",
|
|
"tableTo": "categories",
|
|
"columnsFrom": [
|
|
"category_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "no action",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {
|
|
"questions_id": {
|
|
"name": "questions_id",
|
|
"columns": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"checkConstraint": {}
|
|
},
|
|
"skill_tree": {
|
|
"name": "skill_tree",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"category_id": {
|
|
"name": "category_id",
|
|
"type": "varchar(50)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"title": {
|
|
"name": "title",
|
|
"type": "varchar(100)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"parent_id": {
|
|
"name": "parent_id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"sort_order": {
|
|
"name": "sort_order",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": 0
|
|
},
|
|
"questions_required": {
|
|
"name": "questions_required",
|
|
"type": "tinyint",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": 4
|
|
},
|
|
"pass_threshold": {
|
|
"name": "pass_threshold",
|
|
"type": "tinyint",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": 2
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "CURRENT_TIMESTAMP"
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {
|
|
"skill_tree_category_id_categories_id_fk": {
|
|
"name": "skill_tree_category_id_categories_id_fk",
|
|
"tableFrom": "skill_tree",
|
|
"tableTo": "categories",
|
|
"columnsFrom": [
|
|
"category_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "no action",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {
|
|
"skill_tree_id": {
|
|
"name": "skill_tree_id",
|
|
"columns": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"checkConstraint": {}
|
|
},
|
|
"subscriptions": {
|
|
"name": "subscriptions",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"tier": {
|
|
"name": "tier",
|
|
"type": "enum('free','pro','proplus')",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "'free'"
|
|
},
|
|
"platform": {
|
|
"name": "platform",
|
|
"type": "enum('huawei','apple','google')",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"purchase_token": {
|
|
"name": "purchase_token",
|
|
"type": "varchar(500)",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"expires_at": {
|
|
"name": "expires_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"auto_renew": {
|
|
"name": "auto_renew",
|
|
"type": "tinyint",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": 0
|
|
},
|
|
"status": {
|
|
"name": "status",
|
|
"type": "enum('active','expired','cancelled')",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "'active'"
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "CURRENT_TIMESTAMP"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"uk_subscription_user": {
|
|
"name": "uk_subscription_user",
|
|
"columns": [
|
|
"user_id"
|
|
],
|
|
"isUnique": true
|
|
}
|
|
},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {
|
|
"subscriptions_id": {
|
|
"name": "subscriptions_id",
|
|
"columns": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"checkConstraint": {}
|
|
},
|
|
"user_achievements": {
|
|
"name": "user_achievements",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"achievement_id": {
|
|
"name": "achievement_id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"unlocked_at": {
|
|
"name": "unlocked_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "CURRENT_TIMESTAMP"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"uk_user_achievement": {
|
|
"name": "uk_user_achievement",
|
|
"columns": [
|
|
"user_id",
|
|
"achievement_id"
|
|
],
|
|
"isUnique": true
|
|
}
|
|
},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {
|
|
"user_achievements_id": {
|
|
"name": "user_achievements_id",
|
|
"columns": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"checkConstraint": {}
|
|
},
|
|
"user_chapter_progress": {
|
|
"name": "user_chapter_progress",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"chapter_id": {
|
|
"name": "chapter_id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"status": {
|
|
"name": "status",
|
|
"type": "enum('locked','unlocked','passed','perfect')",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "'locked'"
|
|
},
|
|
"best_correct_count": {
|
|
"name": "best_correct_count",
|
|
"type": "tinyint",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": 0
|
|
},
|
|
"attempts": {
|
|
"name": "attempts",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": 0
|
|
},
|
|
"completed_at": {
|
|
"name": "completed_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
}
|
|
},
|
|
"indexes": {
|
|
"uk_user_chapter": {
|
|
"name": "uk_user_chapter",
|
|
"columns": [
|
|
"user_id",
|
|
"chapter_id"
|
|
],
|
|
"isUnique": true
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"user_chapter_progress_user_id_users_id_fk": {
|
|
"name": "user_chapter_progress_user_id_users_id_fk",
|
|
"tableFrom": "user_chapter_progress",
|
|
"tableTo": "users",
|
|
"columnsFrom": [
|
|
"user_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "no action",
|
|
"onUpdate": "no action"
|
|
},
|
|
"user_chapter_progress_chapter_id_skill_tree_id_fk": {
|
|
"name": "user_chapter_progress_chapter_id_skill_tree_id_fk",
|
|
"tableFrom": "user_chapter_progress",
|
|
"tableTo": "skill_tree",
|
|
"columnsFrom": [
|
|
"chapter_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "no action",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {
|
|
"user_chapter_progress_id": {
|
|
"name": "user_chapter_progress_id",
|
|
"columns": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"checkConstraint": {}
|
|
},
|
|
"user_feedback": {
|
|
"name": "user_feedback",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"content": {
|
|
"name": "content",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"contact": {
|
|
"name": "contact",
|
|
"type": "varchar(255)",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"page_context": {
|
|
"name": "page_context",
|
|
"type": "varchar(200)",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "CURRENT_TIMESTAMP"
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {
|
|
"user_feedback_id": {
|
|
"name": "user_feedback_id",
|
|
"columns": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"checkConstraint": {}
|
|
},
|
|
"user_progress": {
|
|
"name": "user_progress",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"question_id": {
|
|
"name": "question_id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"correct": {
|
|
"name": "correct",
|
|
"type": "tinyint",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"time_ms": {
|
|
"name": "time_ms",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"answered_at": {
|
|
"name": "answered_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "CURRENT_TIMESTAMP"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"idx_user_answered": {
|
|
"name": "idx_user_answered",
|
|
"columns": [
|
|
"user_id",
|
|
"answered_at"
|
|
],
|
|
"isUnique": false
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"user_progress_user_id_users_id_fk": {
|
|
"name": "user_progress_user_id_users_id_fk",
|
|
"tableFrom": "user_progress",
|
|
"tableTo": "users",
|
|
"columnsFrom": [
|
|
"user_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "no action",
|
|
"onUpdate": "no action"
|
|
},
|
|
"user_progress_question_id_questions_id_fk": {
|
|
"name": "user_progress_question_id_questions_id_fk",
|
|
"tableFrom": "user_progress",
|
|
"tableTo": "questions",
|
|
"columnsFrom": [
|
|
"question_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "no action",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {
|
|
"user_progress_id": {
|
|
"name": "user_progress_id",
|
|
"columns": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"checkConstraint": {}
|
|
},
|
|
"users": {
|
|
"name": "users",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "char(36)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"auth_type": {
|
|
"name": "auth_type",
|
|
"type": "enum('huawei','guest','phone','apple','google')",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"auth_id": {
|
|
"name": "auth_id",
|
|
"type": "varchar(255)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"autoincrement": false
|
|
},
|
|
"nickname": {
|
|
"name": "nickname",
|
|
"type": "varchar(50)",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"avatar_url": {
|
|
"name": "avatar_url",
|
|
"type": "varchar(500)",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"tier": {
|
|
"name": "tier",
|
|
"type": "enum('free','pro','proplus')",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "'free'"
|
|
},
|
|
"xp_total": {
|
|
"name": "xp_total",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": 0
|
|
},
|
|
"streak_days": {
|
|
"name": "streak_days",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": 0
|
|
},
|
|
"streak_last_date": {
|
|
"name": "streak_last_date",
|
|
"type": "date",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"hearts_remaining": {
|
|
"name": "hearts_remaining",
|
|
"type": "tinyint",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": 5
|
|
},
|
|
"hearts_last_restore": {
|
|
"name": "hearts_last_restore",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"daily_xp_goal": {
|
|
"name": "daily_xp_goal",
|
|
"type": "smallint",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": 50
|
|
},
|
|
"daily_xp_earned": {
|
|
"name": "daily_xp_earned",
|
|
"type": "smallint",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": 0
|
|
},
|
|
"daily_xp_date": {
|
|
"name": "daily_xp_date",
|
|
"type": "date",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"current_theme": {
|
|
"name": "current_theme",
|
|
"type": "varchar(20)",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "'inkTeal'"
|
|
},
|
|
"active_track_id": {
|
|
"name": "active_track_id",
|
|
"type": "varchar(50)",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"daily_attempts_left": {
|
|
"name": "daily_attempts_left",
|
|
"type": "smallint",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": 5
|
|
},
|
|
"daily_attempts_date": {
|
|
"name": "daily_attempts_date",
|
|
"type": "date",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"check_in_days": {
|
|
"name": "check_in_days",
|
|
"type": "int",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": 0
|
|
},
|
|
"last_check_in_date": {
|
|
"name": "last_check_in_date",
|
|
"type": "date",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"streak_protected_until": {
|
|
"name": "streak_protected_until",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "CURRENT_TIMESTAMP"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "datetime",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"autoincrement": false,
|
|
"default": "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"uk_auth": {
|
|
"name": "uk_auth",
|
|
"columns": [
|
|
"auth_type",
|
|
"auth_id"
|
|
],
|
|
"isUnique": true
|
|
}
|
|
},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {
|
|
"users_id": {
|
|
"name": "users_id",
|
|
"columns": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"checkConstraint": {}
|
|
}
|
|
},
|
|
"views": {},
|
|
"_meta": {
|
|
"schemas": {},
|
|
"tables": {},
|
|
"columns": {}
|
|
},
|
|
"internal": {
|
|
"tables": {},
|
|
"indexes": {}
|
|
}
|
|
} |