mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-03-21 18:04:39 -05:00
* Initial * Calendar initial * Extract EventCalendar * Events list initial * Winners * SQL fixes * List events by series * Leaderboards * Series leaderboard * Own entry peek * Edit page skeleton * RHF initial test * RHF stuff * Form etc. progress * Fix tournament series description * Fix tabs layout * Fix socials insert * Check for not removing admin * Adding series * TODOs * Allow updating org with no series * FormFieldset * Allow series without events * TextAreaFormfield accepting array syntax * Input form array field * ToggleFormField * SelectFormField * UserSearchFormField * Fetch badgeOptions * Badge editing * Progress * Use native preventScrollReset * Rename func * Fix sticky scroll * Fix translation * i18n errors * handle,meta in edit * Add ref to user search * TODOs * Done
73 lines
2.3 KiB
JavaScript
73 lines
2.3 KiB
JavaScript
export function up(db) {
|
|
db.transaction(() => {
|
|
db.prepare(
|
|
/*sql*/ `
|
|
create table "TournamentOrganization" (
|
|
"id" integer primary key,
|
|
"name" text not null,
|
|
"slug" text unique not null,
|
|
"description" text,
|
|
"socials" text,
|
|
"avatarImgId" integer,
|
|
foreign key ("avatarImgId") references "UnvalidatedUserSubmittedImage"("id") on delete set null
|
|
) strict
|
|
`,
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `create index tournament_organization_slug on "TournamentOrganization"("slug")`,
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `
|
|
create table "TournamentOrganizationMember" (
|
|
"organizationId" integer not null,
|
|
"userId" integer not null,
|
|
"role" text not null,
|
|
"roleDisplayName" text,
|
|
foreign key ("organizationId") references "TournamentOrganization"("id") on delete cascade,
|
|
foreign key ("userId") references "User"("id") on delete cascade,
|
|
unique("organizationId", "userId") on conflict rollback
|
|
) strict
|
|
`,
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `
|
|
create table "TournamentOrganizationBadge" (
|
|
"organizationId" integer not null,
|
|
"badgeId" integer not null,
|
|
foreign key ("organizationId") references "TournamentOrganization"("id") on delete cascade,
|
|
foreign key ("badgeId") references "Badge"("id") on delete cascade,
|
|
unique("organizationId", "badgeId") on conflict rollback
|
|
) strict
|
|
`,
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `
|
|
create table "TournamentOrganizationSeries" (
|
|
"id" integer primary key,
|
|
"organizationId" integer not null,
|
|
"name" text not null,
|
|
"description" text,
|
|
"substringMatches" text not null,
|
|
"showLeaderboard" integer not null default 0,
|
|
foreign key ("organizationId") references "TournamentOrganization"("id") on delete cascade
|
|
) strict
|
|
`,
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `create index tournament_organization_series_organization_id on "TournamentOrganizationSeries"("organizationId")`,
|
|
).run();
|
|
|
|
db.prepare(
|
|
/* sql */ `alter table "CalendarEvent" add "organizationId" integer references "TournamentOrganization"("id") on delete set null`,
|
|
).run();
|
|
db.prepare(
|
|
/*sql*/ `create index calendar_event_organization_id on "CalendarEvent"("organizationId")`,
|
|
).run();
|
|
})();
|
|
}
|