From 0d8d5845c927ddc656d676f57dbe13dcf047d0ac Mon Sep 17 00:00:00 2001 From: Tau Date: Mon, 9 Dec 2019 23:00:25 -0500 Subject: [PATCH] schema: Fix M0011 for newly-created databases --- schema/init/cm.sql | 23 +++++++++++++++++++++ schema/migrate/M0012-cm-user-course-fix.sql | 23 +++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 schema/migrate/M0012-cm-user-course-fix.sql diff --git a/schema/init/cm.sql b/schema/init/cm.sql index 715d0d9..10b41ba 100644 --- a/schema/init/cm.sql +++ b/schema/init/cm.sql @@ -82,6 +82,29 @@ create table "cm_user_activity" ( ) ); +create table "cm_user_course" ( + "id" integer primary key not null, + "profile_id" integer not null + references "cm_user_data"("id") + on delete cascade, + "course_id" integer not null, + "class_id" integer not null, + "play_count" integer not null, + "score_max" integer not null, + "is_full_combo" text not null, + "is_all_justice" text not null, + "is_success" text not null, + "score_rank" integer not null, + "event_id" integer not null, + "last_play_date" text not null, + "param1" integer not null, + "param2" integer not null, + "param3" integer not null, + "param4" integer not null, + "is_clear" text not null, + constraint "cm_user_course_uq" unique ("profile_id", "course_id") +); + create table "cm_user_data_ex" ( "id" integer primary key not null references "cm_user_data"("id") diff --git a/schema/migrate/M0012-cm-user-course-fix.sql b/schema/migrate/M0012-cm-user-course-fix.sql new file mode 100644 index 0000000..892a995 --- /dev/null +++ b/schema/migrate/M0012-cm-user-course-fix.sql @@ -0,0 +1,23 @@ +-- This was not present in new DBs initialized to schema version 11. +create table if not exists "cm_user_course" ( + "id" integer primary key not null, + "profile_id" integer not null + references "cm_user_data"("id") + on delete cascade, + "course_id" integer not null, + "class_id" integer not null, + "play_count" integer not null, + "score_max" integer not null, + "is_full_combo" text not null, + "is_all_justice" text not null, + "is_success" text not null, + "score_rank" integer not null, + "event_id" integer not null, + "last_play_date" text not null, + "param1" integer not null, + "param2" integer not null, + "param3" integer not null, + "param4" integer not null, + "is_clear" text not null, + constraint "cm_user_course_uq" unique ("profile_id", "course_id") +);