Skip to content

Commit

Permalink
in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
vorant94 committed Dec 7, 2024
1 parent bacdf7a commit b4e17a3
Show file tree
Hide file tree
Showing 37 changed files with 775 additions and 123 deletions.
4 changes: 2 additions & 2 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { config } from "dotenv";
import { defineConfig } from "drizzle-kit";
import { envSchema } from "./src/shared/context/env.ts";
import { configSchema } from "./src/shared/env/config.ts";
import { dbConfig } from "./src/shared/schema/db-config";

const env = envSchema
const env = configSchema
.pick({
// biome-ignore lint/style/useNamingConvention: env variables have different convention
DB_FILE_NAME: true,
Expand Down
12 changes: 12 additions & 0 deletions drizzle/0003_loose_havok.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CREATE TABLE `sites` (
`id` text PRIMARY KEY NOT NULL,
`resource_type` text DEFAULT 'site' NOT NULL,
`created_at` text DEFAULT (CURRENT_TIMESTAMP) NOT NULL,
`updated_at` text DEFAULT (CURRENT_TIMESTAMP) NOT NULL,
`name` text NOT NULL,
`site_id` text NOT NULL,
`chain_id` text NOT NULL,
FOREIGN KEY (`chain_id`) REFERENCES `chains`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
ALTER TABLE `chains` ADD `type` text;
1 change: 1 addition & 0 deletions drizzle/0004_glossy_dormammu.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE UNIQUE INDEX `chains_type_unique` ON `chains` (`type`);
207 changes: 207 additions & 0 deletions drizzle/meta/0003_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
{
"version": "6",
"dialect": "sqlite",
"id": "69a2a7f5-440f-4ec1-88a7-74cd7360d6d2",
"prevId": "132ca062-77cb-4b35-a3c8-3dbe452350ce",
"tables": {
"chains": {
"name": "chains",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"resource_type": {
"name": "resource_type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'chain'"
},
"created_at": {
"name": "created_at",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(CURRENT_TIMESTAMP)"
},
"updated_at": {
"name": "updated_at",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(CURRENT_TIMESTAMP)"
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"sites": {
"name": "sites",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"resource_type": {
"name": "resource_type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'site'"
},
"created_at": {
"name": "created_at",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(CURRENT_TIMESTAMP)"
},
"updated_at": {
"name": "updated_at",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(CURRENT_TIMESTAMP)"
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"site_id": {
"name": "site_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"chain_id": {
"name": "chain_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"sites_chain_id_chains_id_fk": {
"name": "sites_chain_id_chains_id_fk",
"tableFrom": "sites",
"tableTo": "chains",
"columnsFrom": ["chain_id"],
"columnsTo": ["id"],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"users": {
"name": "users",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"resource_type": {
"name": "resource_type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'user'"
},
"created_at": {
"name": "created_at",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(CURRENT_TIMESTAMP)"
},
"updated_at": {
"name": "updated_at",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(CURRENT_TIMESTAMP)"
},
"telegram_chat_id": {
"name": "telegram_chat_id",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"role": {
"name": "role",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'user'"
}
},
"indexes": {
"users_telegramChatId_unique": {
"name": "users_telegramChatId_unique",
"columns": ["telegram_chat_id"],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
}
},
"views": {},
"enums": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
},
"internal": {
"indexes": {}
}
}
Loading

0 comments on commit b4e17a3

Please sign in to comment.