mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-03-21 18:04:39 -05:00
* Initial * Progress * Initial UI * Can submit request * Progress * Show text if no scrims * Can cancel request, tabs * Delete post * Popover if can't delete * Request rows * Progress * Scrim page initial * Fix migration order * Progress * Progress * Works again * Make it compile * Make it compile again * Work * Progress * Progress * Progress * Associations initial * Association visibility work * notFoundVisibility form fields initial * Progress * Association leave/join + reset invite code * Progress * Select test * Merge branch 'rewrite' into scrims * Remeda for groupBy * Select with search * Outline styling for select * Select done? * Fix prop names * Paginated badges * Less important * Select no results * Handle limiting select width * UserSearch non-working * Fix problem from merge * Remove UserSearch for now * Remove todo * Flaggable * Remove TODOs * i18n start + styling * Progress * i18n done * Add association e2e test * E2E tests * Done? * Couple leftovers
113 lines
3.3 KiB
JavaScript
113 lines
3.3 KiB
JavaScript
export function up(db) {
|
|
db.transaction(() => {
|
|
db.prepare(
|
|
/*sql*/ `
|
|
create table "ScrimPost" (
|
|
"id" integer primary key,
|
|
"at" integer not null,
|
|
"maxDiv" integer,
|
|
"minDiv" integer,
|
|
"visibility" text,
|
|
"text" text,
|
|
"chatCode" text not null,
|
|
"teamId" integer,
|
|
"createdAt" integer default (strftime('%s', 'now')) not null,
|
|
"updatedAt" integer default (strftime('%s', 'now')) not null,
|
|
foreign key ("teamId") references "AllTeam"("id") on delete cascade
|
|
) strict
|
|
`,
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `create index scrim_post_team_id on "ScrimPost"("teamId")`,
|
|
).run();
|
|
db.prepare(/*sql*/ `create index scrim_post_at on "ScrimPost"("at")`).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `
|
|
create table "ScrimPostUser" (
|
|
"scrimPostId" integer not null,
|
|
"userId" integer not null,
|
|
"isOwner" integer not null,
|
|
unique("scrimPostId", "userId") on conflict rollback,
|
|
foreign key ("scrimPostId") references "ScrimPost"("id") on delete cascade,
|
|
foreign key ("userId") references "User"("id") on delete cascade
|
|
) strict
|
|
`,
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `
|
|
create table "ScrimPostRequest" (
|
|
"id" integer primary key,
|
|
"scrimPostId" integer not null,
|
|
"teamId" integer,
|
|
"isAccepted" integer default 0 not null,
|
|
"createdAt" integer default (strftime('%s', 'now')) not null,
|
|
unique("scrimPostId", "teamId") on conflict rollback,
|
|
foreign key ("scrimPostId") references "ScrimPost"("id") on delete cascade,
|
|
foreign key ("teamId") references "AllTeam"("id") on delete cascade
|
|
) strict
|
|
`,
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `create index scrim_post_request_scrim_post_id on "ScrimPostRequest"("scrimPostId")`,
|
|
).run();
|
|
db.prepare(
|
|
/*sql*/ `create index scrim_post_request_team_id on "ScrimPostRequest"("teamId")`,
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `
|
|
create table "ScrimPostRequestUser" (
|
|
"scrimPostRequestId" integer not null,
|
|
"userId" integer not null,
|
|
"isOwner" integer not null,
|
|
unique("scrimPostRequestId", "userId") on conflict rollback,
|
|
foreign key ("scrimPostRequestId") references "ScrimPostRequest"("id") on delete cascade,
|
|
foreign key ("userId") references "User"("id") on delete cascade
|
|
) strict
|
|
`,
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `create index scrim_post_request_user_scrim_post_request_id on "ScrimPostRequestUser"("scrimPostRequestId")`,
|
|
).run();
|
|
db.prepare(
|
|
/*sql*/ `create index scrim_post_request_user_user_id on "ScrimPostRequestUser"("userId")`,
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `
|
|
create table "Association" (
|
|
"id" integer primary key,
|
|
"name" text not null,
|
|
"inviteCode" text not null unique,
|
|
"createdAt" integer default (strftime('%s', 'now')) not null
|
|
) strict
|
|
`,
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `
|
|
create table "AssociationMember" (
|
|
"userId" integer not null,
|
|
"associationId" integer not null,
|
|
"role" text not null,
|
|
unique("userId", "associationId") on conflict rollback,
|
|
foreign key ("userId") references "User"("id") on delete cascade,
|
|
foreign key ("associationId") references "Association"("id") on delete cascade
|
|
) strict
|
|
`,
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `create index association_member_user_id on "AssociationMember"("userId")`,
|
|
).run();
|
|
db.prepare(
|
|
/*sql*/ `create index association_member_association_id on "AssociationMember"("associationId")`,
|
|
).run();
|
|
})();
|
|
}
|