-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_SitePreferences" (
    "id" TEXT NOT NULL PRIMARY KEY DEFAULT 'global',
    "homeBackground" TEXT,
    "eventsBackground" TEXT,
    "leaderboardBackground" TEXT,
    "challengesBackground" TEXT,
    "eventRegistrationPoints" INTEGER NOT NULL DEFAULT 100,
    "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" DATETIME NOT NULL
);
INSERT INTO "new_SitePreferences" ("challengesBackground", "createdAt", "eventsBackground", "homeBackground", "id", "leaderboardBackground", "updatedAt") SELECT "challengesBackground", "createdAt", "eventsBackground", "homeBackground", "id", "leaderboardBackground", "updatedAt" FROM "SitePreferences";
DROP TABLE "SitePreferences";
ALTER TABLE "new_SitePreferences" RENAME TO "SitePreferences";
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;
