mirror of
https://github.com/fosrl/pangolin.git
synced 2025-07-23 20:24:34 +02:00
add migration for 1.6.0
This commit is contained in:
parent
1bf2e23f5d
commit
f300838f8e
3 changed files with 37 additions and 2 deletions
|
@ -1,4 +1,6 @@
|
|||
import { db } from "@server/db/pg/driver";
|
||||
import { configFilePath1, configFilePath2 } from "@server/lib/consts";
|
||||
import { sql } from "drizzle-orm";
|
||||
import fs from "fs";
|
||||
import yaml from "js-yaml";
|
||||
|
||||
|
@ -7,6 +9,15 @@ const version = "1.6.0";
|
|||
export default async function migration() {
|
||||
console.log(`Running setup script ${version}...`);
|
||||
|
||||
try {
|
||||
db.execute(sql`UPDATE 'user' SET email = LOWER(email);`);
|
||||
db.execute(sql`UPDATE 'user' SET username = LOWER(username);`);
|
||||
console.log(`Migrated database schema`);
|
||||
} catch (e) {
|
||||
console.log("Unable to make all usernames and emails lowercase");
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
try {
|
||||
// Determine which config file exists
|
||||
const filePaths = [configFilePath1, configFilePath2];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue