v3: added customizable site emoji (logo), small visual tweaks
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 41s
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 41s
This commit is contained in:
@@ -5,6 +5,7 @@ import { up as up0003DumpBacklinks } from "./migrations/0003_dump_backlinks.ts";
|
||||
import { up as up0004UserRoles } from "./migrations/0004_user_roles.ts";
|
||||
import { up as up0005DropIsAdmin } from "./migrations/0005_drop_is_admin.ts";
|
||||
import { up as up0006Categories } from "./migrations/0006_categories.ts";
|
||||
import { up as up0007PasswordResetTokens } from "./migrations/0007_password_reset_tokens.ts";
|
||||
|
||||
interface Migration {
|
||||
name: string;
|
||||
@@ -21,6 +22,7 @@ const MIGRATIONS: Migration[] = [
|
||||
{ name: "0004_user_roles", up: up0004UserRoles },
|
||||
{ name: "0005_drop_is_admin", up: up0005DropIsAdmin },
|
||||
{ name: "0006_categories", up: up0006Categories },
|
||||
{ name: "0007_password_reset_tokens", up: up0007PasswordResetTokens },
|
||||
];
|
||||
|
||||
export function runMigrations(db: DatabaseSync): void {
|
||||
|
||||
23
api/db/migrations/0007_password_reset_tokens.ts
Normal file
23
api/db/migrations/0007_password_reset_tokens.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import type { DatabaseSync } from "node:sqlite";
|
||||
|
||||
// Idempotent: safe to run against a fresh db (already created from schema.sql
|
||||
// with password_reset_tokens) or an existing one that predates the table.
|
||||
export function up(db: DatabaseSync): void {
|
||||
const tables = new Set(
|
||||
(db.prepare(
|
||||
`SELECT name FROM sqlite_master WHERE type = 'table';`,
|
||||
).all() as { name: string }[]).map((r) => r.name),
|
||||
);
|
||||
|
||||
if (!tables.has("password_reset_tokens")) {
|
||||
db.exec(
|
||||
`CREATE TABLE password_reset_tokens (
|
||||
token TEXT PRIMARY KEY,
|
||||
user_id TEXT NOT NULL,
|
||||
expires_at TEXT NOT NULL,
|
||||
used_at TEXT,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
||||
);`,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user