From 601ce32ee8d0cee32b66c87b0bfefa7424a5b8c8 Mon Sep 17 00:00:00 2001 From: fusion32 Date: Sat, 18 Oct 2025 02:32:59 -0300 Subject: modify how automatic SQLite patches/upgrades works + overall cleanup --- postgres/schema.sql | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'postgres/schema.sql') diff --git a/postgres/schema.sql b/postgres/schema.sql index 32afe2c..efe9133 100644 --- a/postgres/schema.sql +++ b/postgres/schema.sql @@ -29,6 +29,17 @@ CREATE COLLATION NOCASE ( -- using them here. It might be a good idea for consistency, but it's not a hard -- requirement. +-- NOTE(fusion): A table with schema information. It currently only contains the +-- schema version which is checked at startup against `POSTGRESQL_SCHEMA_VERSION`, +-- defined in `database_postgres.cc`. The query manager will only startup if the +-- versions match. +CREATE TABLE SchemaInfo ( + Key TEXT NOT NULL COLLATE NOCASE, + Value TEXT NOT NULL, + PRIMARY KEY (Key) +); +INSERT INTO SchemaInfo (Key, Value) VALUES ('VERSION', '1'); + -- Primary Tables --============================================================================== CREATE TABLE Worlds ( @@ -280,17 +291,4 @@ CREATE TABLE OnlineCharacters ( PRIMARY KEY (WorldID, Name) ); --- Schema Info ---============================================================================== --- NOTE(fusion): The `SchemaInfo` table should hold information about the schema --- and be used for consistency checks at startup. It currently only contains the --- schema version, which I feel is the only value needed. -CREATE TABLE SchemaInfo ( - Key TEXT NOT NULL COLLATE NOCASE, - Value TEXT NOT NULL, - PRIMARY KEY (Key) -); - -INSERT INTO SchemaInfo (Key, Value) VALUES ('VERSION', '1'); - COMMIT; -- cgit v1.2.3