fix(database): 🚑 Fixed migrations not running on fresh databases

Incorrect SQL data in migrations would cause freshly created database to fail migrations
This commit is contained in:
Jesse Wierzbinski 2024-04-14 13:41:11 -10:00
parent 2e2b91d7a5
commit ac3ef0ea06
No known key found for this signature in database
4 changed files with 5 additions and 5 deletions

View file

@ -1,5 +1,6 @@
{ {
"typescript.tsdk": "node_modules/typescript/lib", "typescript.tsdk": "node_modules/typescript/lib",
"jest.jestCommandLine": "/home/jessew/.bun/bin/bun test", "jest.jestCommandLine": "/home/jessew/.bun/bin/bun test",
"jest.rootPath": "." "jest.rootPath": ".",
"conventionalCommits.scopes": ["database"]
} }

View file

@ -181,7 +181,7 @@ CREATE TABLE IF NOT EXISTS "User" (
"isBot" boolean DEFAULT false NOT NULL, "isBot" boolean DEFAULT false NOT NULL,
"isLocked" boolean DEFAULT false NOT NULL, "isLocked" boolean DEFAULT false NOT NULL,
"isDiscoverable" boolean DEFAULT false NOT NULL, "isDiscoverable" boolean DEFAULT false NOT NULL,
"sanctions" text[] DEFAULT 'RRAY[', "sanctions" text[],
"publicKey" text NOT NULL, "publicKey" text NOT NULL,
"privateKey" text, "privateKey" text,
"instanceId" uuid, "instanceId" uuid,

View file

@ -1345,8 +1345,7 @@
"name": "sanctions", "name": "sanctions",
"type": "text[]", "type": "text[]",
"primaryKey": false, "primaryKey": false,
"notNull": false, "notNull": false
"default": "'RRAY['"
}, },
"publicKey": { "publicKey": {
"name": "publicKey", "name": "publicKey",

View file

@ -308,7 +308,7 @@ export const user = pgTable(
isBot: boolean("is_bot").default(false).notNull(), isBot: boolean("is_bot").default(false).notNull(),
isLocked: boolean("is_locked").default(false).notNull(), isLocked: boolean("is_locked").default(false).notNull(),
isDiscoverable: boolean("is_discoverable").default(false).notNull(), isDiscoverable: boolean("is_discoverable").default(false).notNull(),
sanctions: text("sanctions").default("RRAY[").array(), sanctions: text("sanctions").array(),
publicKey: text("public_key").notNull(), publicKey: text("public_key").notNull(),
privateKey: text("private_key"), privateKey: text("private_key"),
instanceId: uuid("instanceId").references(() => instance.id, { instanceId: uuid("instanceId").references(() => instance.id, {