44 lines
2.2 KiB
SQL
44 lines
2.2 KiB
SQL
/*
|
|
Warnings:
|
|
|
|
- You are about to alter the column `phone` on the `Account` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
|
|
- The primary key for the `AccountInformation` table will be changed. If it partially fails, the table could be left without primary key constraint.
|
|
- You are about to alter the column `age` on the `AccountInformation` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
|
|
- You are about to alter the column `id` on the `AccountInformation` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
|
|
|
|
*/
|
|
-- RedefineTables
|
|
PRAGMA defer_foreign_keys=ON;
|
|
PRAGMA foreign_keys=OFF;
|
|
CREATE TABLE "new_Account" (
|
|
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
|
"type" TEXT,
|
|
"firstName" TEXT,
|
|
"lastName" TEXT,
|
|
"email" TEXT,
|
|
"phone" INTEGER,
|
|
"company" TEXT,
|
|
"password" TEXT
|
|
);
|
|
INSERT INTO "new_Account" ("company", "email", "firstName", "id", "lastName", "password", "phone", "type") SELECT "company", "email", "firstName", "id", "lastName", "password", "phone", "type" FROM "Account";
|
|
DROP TABLE "Account";
|
|
ALTER TABLE "new_Account" RENAME TO "Account";
|
|
CREATE TABLE "new_AccountInformation" (
|
|
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
|
"sex" TEXT,
|
|
"age" INTEGER,
|
|
"suburb" BIGINT,
|
|
"postcode" BIGINT,
|
|
"state" BIGINT,
|
|
"searchPostcode" BIGINT,
|
|
"searchRadius" BIGINT,
|
|
"accountId" INTEGER NOT NULL,
|
|
CONSTRAINT "AccountInformation_accountId_fkey" FOREIGN KEY ("accountId") REFERENCES "Account" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
|
);
|
|
INSERT INTO "new_AccountInformation" ("accountId", "age", "id", "postcode", "searchPostcode", "searchRadius", "sex", "state", "suburb") SELECT "accountId", "age", "id", "postcode", "searchPostcode", "searchRadius", "sex", "state", "suburb" FROM "AccountInformation";
|
|
DROP TABLE "AccountInformation";
|
|
ALTER TABLE "new_AccountInformation" RENAME TO "AccountInformation";
|
|
CREATE UNIQUE INDEX "AccountInformation_accountId_key" ON "AccountInformation"("accountId");
|
|
PRAGMA foreign_keys=ON;
|
|
PRAGMA defer_foreign_keys=OFF;
|