fix(deps): update dependency drizzle-kit to ^0.21.1 (#462)

* fix(deps): update dependency drizzle-kit to ^0.21.0

* fix(deps): update dependency drizzle-kit to ^0.21.1

* fix: migrate to drizzle kit 0.21

* fix: format issues

* feat: add default env variables for db dialect and driver

* fix: issue with driver seems to be fixed

---------

Co-authored-by: homarr-renovate[bot] <158783068+homarr-renovate[bot]@users.noreply.github.com>
Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
This commit is contained in:
homarr-renovate[bot]
2024-05-10 23:46:01 +02:00
committed by GitHub
parent 2434e2e758
commit 1ce6fb0d0f
21 changed files with 367 additions and 2476 deletions

View File

@@ -82,6 +82,20 @@ CREATE TABLE `group` (
FOREIGN KEY (`owner_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE set null
);
--> statement-breakpoint
CREATE TABLE `iconRepository` (
`iconRepository_id` text PRIMARY KEY NOT NULL,
`iconRepository_slug` text NOT NULL
);
--> statement-breakpoint
CREATE TABLE `icon` (
`icon_id` text PRIMARY KEY NOT NULL,
`icon_name` text NOT NULL,
`icon_url` text NOT NULL,
`icon_checksum` text NOT NULL,
`iconRepository_id` text NOT NULL,
FOREIGN KEY (`iconRepository_id`) REFERENCES `iconRepository`(`iconRepository_id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `integration_item` (
`item_id` text NOT NULL,
`integration_id` text NOT NULL,

View File

@@ -1,13 +0,0 @@
CREATE TABLE `iconRepository` (
`iconRepository_id` text PRIMARY KEY NOT NULL,
`iconRepository_slug` text NOT NULL
);
--> statement-breakpoint
CREATE TABLE `icon` (
`icon_id` text PRIMARY KEY NOT NULL,
`icon_name` text NOT NULL,
`icon_url` text NOT NULL,
`icon_checksum` text NOT NULL,
`iconRepository_id` text NOT NULL,
FOREIGN KEY (`iconRepository_id`) REFERENCES `iconRepository`(`iconRepository_id`) ON UPDATE no action ON DELETE cascade
);

View File

@@ -1,7 +1,7 @@
{
"version": "5",
"version": "6",
"dialect": "sqlite",
"id": "116fcd87-09c7-4c7c-b590-0ed5681ffdc5",
"id": "0575873a-9e10-4480-8d7d-c47198622c22",
"prevId": "00000000-0000-0000-0000-000000000000",
"tables": {
"account": {
@@ -535,6 +535,83 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"iconRepository": {
"name": "iconRepository",
"columns": {
"iconRepository_id": {
"name": "iconRepository_id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"iconRepository_slug": {
"name": "iconRepository_slug",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"icon": {
"name": "icon",
"columns": {
"icon_id": {
"name": "icon_id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"icon_name": {
"name": "icon_name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"icon_url": {
"name": "icon_url",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"icon_checksum": {
"name": "icon_checksum",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"iconRepository_id": {
"name": "iconRepository_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"icon_iconRepository_id_iconRepository_iconRepository_id_fk": {
"name": "icon_iconRepository_id_iconRepository_iconRepository_id_fk",
"tableFrom": "icon",
"tableTo": "iconRepository",
"columnsFrom": ["iconRepository_id"],
"columnsTo": ["iconRepository_id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"integration_item": {
"name": "integration_item",
"columns": {

File diff suppressed because it is too large Load Diff

View File

@@ -1,19 +1,12 @@
{
"version": "5",
"version": "6",
"dialect": "sqlite",
"entries": [
{
"idx": 0,
"version": "5",
"when": 1714817544524,
"tag": "0000_premium_forgotten_one",
"breakpoints": true
},
{
"idx": 1,
"version": "5",
"when": 1714854863811,
"tag": "0001_unusual_rage",
"version": "6",
"when": 1715334238443,
"tag": "0000_talented_ben_parker",
"breakpoints": true
}
]

View File

@@ -0,0 +1,11 @@
import Database from "better-sqlite3";
import { drizzle } from "drizzle-orm/better-sqlite3";
import { migrate } from "drizzle-orm/better-sqlite3/migrator";
const migrationsFolder = process.argv[2] ?? ".";
const sqlite = new Database(process.env.DB_URL?.replace("file:", ""));
const db = drizzle(sqlite);
migrate(db, { migrationsFolder });