added basic proxyTargets schema

This commit is contained in:
Milo Schwartz 2024-09-27 22:11:37 -04:00
parent 3fea8be65f
commit 6c91415de4
No known key found for this signature in database
4 changed files with 99 additions and 5 deletions

View file

@ -1,10 +1,12 @@
import { InferSelectModel } from "drizzle-orm"; import { InferSelectModel } from "drizzle-orm";
import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core"; import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
export const schools = sqliteTable("schools", { export const proxyTargets = sqliteTable("proxyTargets", {
id: integer("id").primaryKey({ autoIncrement: true }), id: text("id").unique().notNull().primaryKey(),
name: text("name"), target: text("target").notNull(),
abbreviation: text("abbreviation"), rule: text("rule").notNull(),
entryPoint: text("entryPoint").notNull(),
enabled: integer("enabled", { mode: "boolean" }).notNull().default(true),
}); });
export type SelectSchoolType = InferSelectModel<typeof schools>; export type SelectProxyTargets = InferSelectModel<typeof proxyTargets>;

View file

@ -0,0 +1,9 @@
CREATE TABLE `proxyTargets` (
`id` text PRIMARY KEY NOT NULL,
`target` text NOT NULL,
`rule` text NOT NULL,
`entryPoint` text NOT NULL,
`enabled` integer DEFAULT 1 NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `proxyTargets_id_unique` ON `proxyTargets` (`id`);

View file

@ -0,0 +1,70 @@
{
"version": "6",
"dialect": "sqlite",
"id": "341a41b7-2cc2-4967-b0cf-ec35f6d0486a",
"prevId": "00000000-0000-0000-0000-000000000000",
"tables": {
"proxyTargets": {
"name": "proxyTargets",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"target": {
"name": "target",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"rule": {
"name": "rule",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"entryPoint": {
"name": "entryPoint",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"enabled": {
"name": "enabled",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 1
}
},
"indexes": {
"proxyTargets_id_unique": {
"name": "proxyTargets_id_unique",
"columns": [
"id"
],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
},
"internal": {
"indexes": {}
}
}

View file

@ -0,0 +1,13 @@
{
"version": "7",
"dialect": "sqlite",
"entries": [
{
"idx": 0,
"version": "6",
"when": 1727489319772,
"tag": "0000_petite_zarda",
"breakpoints": true
}
]
}