db: add moderator boolean to actor schema
vi did:web:vt3e.cat
Tue, 26 May 2026 23:34:13 +0100
3 files changed,
237 insertions(+),
3 deletions(-)
A
pkgs/db/drizzle/20260526223342_fair_bullseye/migration.sql
@@ -0,0 +1,1 @@
+ALTER TABLE `actors` ADD `moderator` integer;
A
pkgs/db/drizzle/20260526223342_fair_bullseye/snapshot.json
@@ -0,0 +1,231 @@
+{ + "version": "7", + "dialect": "sqlite", + "id": "aefd1f03-d714-480c-9628-6877616b4425", + "prevIds": [ + "0771a4dc-9b9f-4342-b6cc-7368e6e6ac93" + ], + "ddl": [ + { + "name": "actors", + "entityType": "tables" + }, + { + "name": "sessions", + "entityType": "tables" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": true, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "actors" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "discord_id", + "entityType": "columns", + "table": "actors" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "display_name", + "entityType": "columns", + "table": "actors" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "username", + "entityType": "columns", + "table": "actors" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "avatar", + "entityType": "columns", + "table": "actors" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "moderator", + "entityType": "columns", + "table": "actors" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "actors" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "actors" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "deleted_at", + "entityType": "columns", + "table": "actors" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "sessions" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_id", + "entityType": "columns", + "table": "sessions" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "access_token", + "entityType": "columns", + "table": "sessions" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "refresh_token", + "entityType": "columns", + "table": "sessions" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "scope", + "entityType": "columns", + "table": "sessions" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "token_type", + "entityType": "columns", + "table": "sessions" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "expires_at", + "entityType": "columns", + "table": "sessions" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "sessions" + }, + { + "columns": [ + "user_id" + ], + "tableTo": "actors", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "nameExplicit": false, + "name": "fk_sessions_user_id_actors_id_fk", + "entityType": "fks", + "table": "sessions" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "actors_pk", + "table": "actors", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "sessions_pk", + "table": "sessions", + "entityType": "pks" + }, + { + "columns": [ + "discord_id" + ], + "nameExplicit": false, + "name": "actors_discord_id_unique", + "entityType": "uniques", + "table": "actors" + } + ], + "renames": [] +}
M
pkgs/db/src/schemas/index.ts
→
pkgs/db/src/schemas/index.ts
@@ -9,6 +9,8 @@ displayName: s.text("display_name"),
username: s.text("username"), avatar: s.text("avatar"), + moderator: s.integer("moderator", { mode: "boolean" }), + createdAt: s.integer("created_at", { mode: "timestamp" }).notNull(), updatedAt: s.integer("updated_at", { mode: "timestamp" }).notNull(), deletedAt: s.integer("deleted_at", { mode: "timestamp" }),@@ -23,11 +25,11 @@ .references(() => actors.id),
accessToken: s.text("access_token").notNull(), refreshToken: s.text("refresh_token").notNull(), - expiresAt: s.integer("expires_at", { mode: "timestamp" }).notNull(), - createdAt: s.integer("created_at", { mode: "timestamp" }).notNull(), - scope: s.text("scope"), tokenType: s.text("token_type"), + + expiresAt: s.integer("expires_at", { mode: "timestamp" }).notNull(), + createdAt: s.integer("created_at", { mode: "timestamp" }).notNull(), }); export const actorRelationships = defineRelations({ actors, sessions }, (r) => ({