Implement SQLite database file initialization and migration
This commit is contained in:
parent
92c2670b0b
commit
f0b5b080ba
8 changed files with 296 additions and 11 deletions
|
|
@ -0,0 +1,72 @@
|
|||
-- Initialize a new database file using the current schema version
|
||||
|
||||
PRAGMA user_version = 1;
|
||||
|
||||
CREATE TABLE "Account" (
|
||||
"Id" INTEGER NOT NULL UNIQUE,
|
||||
"Email" TEXT NOT NULL UNIQUE,
|
||||
"PlayerName" TEXT NOT NULL UNIQUE,
|
||||
"PasswordHash" BLOB NOT NULL,
|
||||
"Salt" BLOB NOT NULL,
|
||||
"UserLevel" INTEGER NOT NULL,
|
||||
"IsBanned" INTEGER NOT NULL,
|
||||
"IsArchived" INTEGER NOT NULL,
|
||||
"IsPasswordExpired" INTEGER NOT NULL,
|
||||
PRIMARY KEY("Id")
|
||||
);
|
||||
|
||||
CREATE TABLE "Player" (
|
||||
"DbGuid" INTEGER NOT NULL UNIQUE,
|
||||
"ArchiveData" BLOB,
|
||||
"StartTarget" INTEGER,
|
||||
"StartTargetRegionOverride" INTEGER,
|
||||
"AOIVolume" INTEGER,
|
||||
FOREIGN KEY("DbGuid") REFERENCES "Account"("Id") ON DELETE CASCADE,
|
||||
PRIMARY KEY("DbGuid")
|
||||
);
|
||||
|
||||
CREATE TABLE "Avatar" (
|
||||
"DbGuid" INTEGER NOT NULL UNIQUE,
|
||||
"ContainerDbGuid" INTEGER,
|
||||
"InventoryProtoGuid" INTEGER,
|
||||
"Slot" INTEGER,
|
||||
"EntityProtoGuid" INTEGER,
|
||||
"ArchiveData" BLOB,
|
||||
FOREIGN KEY("ContainerDbGuid") REFERENCES "Player"("DbGuid") ON DELETE CASCADE,
|
||||
PRIMARY KEY("DbGuid")
|
||||
);
|
||||
|
||||
CREATE TABLE "TeamUp" (
|
||||
"DbGuid" INTEGER NOT NULL UNIQUE,
|
||||
"ContainerDbGuid" INTEGER,
|
||||
"InventoryProtoGuid" INTEGER,
|
||||
"Slot" INTEGER,
|
||||
"EntityProtoGuid" INTEGER,
|
||||
"ArchiveData" BLOB,
|
||||
FOREIGN KEY("ContainerDbGuid") REFERENCES "Player"("DbGuid") ON DELETE CASCADE,
|
||||
PRIMARY KEY("DbGuid")
|
||||
);
|
||||
|
||||
CREATE TABLE "Item" (
|
||||
"DbGuid" INTEGER NOT NULL UNIQUE,
|
||||
"ContainerDbGuid" INTEGER,
|
||||
"InventoryProtoGuid" INTEGER,
|
||||
"Slot" INTEGER,
|
||||
"EntityProtoGuid" INTEGER,
|
||||
"ArchiveData" BLOB,
|
||||
FOREIGN KEY("ContainerDbGuid") REFERENCES "Player"("DbGuid") ON DELETE CASCADE,
|
||||
FOREIGN KEY("ContainerDbGuid") REFERENCES "Avatar"("DbGuid") ON DELETE CASCADE,
|
||||
FOREIGN KEY("ContainerDbGuid") REFERENCES "TeamUp"("DbGuid") ON DELETE CASCADE,
|
||||
PRIMARY KEY("DbGuid")
|
||||
);
|
||||
|
||||
CREATE TABLE "ControlledEntity" (
|
||||
"DbGuid" INTEGER NOT NULL UNIQUE,
|
||||
"ContainerDbGuid" INTEGER,
|
||||
"InventoryProtoGuid" INTEGER,
|
||||
"Slot" INTEGER,
|
||||
"EntityProtoGuid" INTEGER,
|
||||
"ArchiveData" BLOB,
|
||||
FOREIGN KEY("ContainerDbGuid") REFERENCES "Avatar"("DbGuid") ON DELETE CASCADE,
|
||||
PRIMARY KEY("DbGuid")
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue