chore: relocate backend into apps/api ahead of monorepo merge

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-24 12:20:40 +08:00
co-authored by Claude Sonnet 5
parent af44598df6
commit eaa6d2276a
388 changed files with 0 additions and 13998 deletions
@@ -0,0 +1,38 @@
'use strict';
// Raw SQL for the same CockroachDB DO-block/CREATE TYPE reason as
// 20270101000067-create-completion-requirements.js.
module.exports = {
async up(queryInterface) {
await queryInterface.sequelize.query(`
CREATE TABLE completion_requirement_progress (
progress_id UUID PRIMARY KEY,
requirement_id UUID NOT NULL REFERENCES completion_requirements (requirement_id) ON DELETE CASCADE,
user_id BIGINT NOT NULL REFERENCES users (user_id) ON DELETE CASCADE,
entity_type STRING NOT NULL,
entity_id BIGINT NOT NULL,
progress_percent INTEGER NULL,
completed BOOLEAN NOT NULL DEFAULT false,
completed_at TIMESTAMPTZ NULL,
block_progress JSONB NULL,
"createdBy" BIGINT NULL,
"updatedBy" BIGINT NULL,
"createdAt" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT check_crp2_entity_type CHECK (entity_type IN ('course', 'unit', 'lesson')),
CONSTRAINT uq_crp2_requirement_user UNIQUE (requirement_id, user_id)
);
`);
await queryInterface.sequelize.query(
`CREATE INDEX idx_crp2_user_id ON completion_requirement_progress (user_id);`
);
await queryInterface.sequelize.query(
`CREATE INDEX idx_crp2_entity_type_entity_id ON completion_requirement_progress (entity_type, entity_id);`
);
},
async down(queryInterface) {
await queryInterface.sequelize.query(`DROP TABLE IF EXISTS completion_requirement_progress;`);
},
};