feat: set up Drizzle
This commit is contained in:
14
drizzle/0000_left_reavers.sql
Normal file
14
drizzle/0000_left_reavers.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
CREATE TABLE `token` (
|
||||
`device_id` text PRIMARY KEY NOT NULL,
|
||||
`token` text NOT NULL,
|
||||
`username` text,
|
||||
`last_connected_at` text DEFAULT (CURRENT_TIMESTAMP)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `watch_status` (
|
||||
`device_id` text NOT NULL,
|
||||
`title_id` integer NOT NULL,
|
||||
`watch_status` text NOT NULL,
|
||||
PRIMARY KEY(`device_id`, `title_id`),
|
||||
FOREIGN KEY (`device_id`) REFERENCES `token`(`device_id`) ON UPDATE no action ON DELETE no action
|
||||
);
|
||||
1
drizzle/0001_purple_franklin_richards.sql
Normal file
1
drizzle/0001_purple_franklin_richards.sql
Normal file
@@ -0,0 +1 @@
|
||||
ALTER TABLE `watch_status` DROP COLUMN `watch_status`;
|
||||
100
drizzle/meta/0000_snapshot.json
Normal file
100
drizzle/meta/0000_snapshot.json
Normal file
@@ -0,0 +1,100 @@
|
||||
{
|
||||
"version": "6",
|
||||
"dialect": "sqlite",
|
||||
"id": "4ecf912c-2ffc-4a17-924b-8694ced4d7b6",
|
||||
"prevId": "00000000-0000-0000-0000-000000000000",
|
||||
"tables": {
|
||||
"token": {
|
||||
"name": "token",
|
||||
"columns": {
|
||||
"device_id": {
|
||||
"name": "device_id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"token": {
|
||||
"name": "token",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"username": {
|
||||
"name": "username",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
},
|
||||
"last_connected_at": {
|
||||
"name": "last_connected_at",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false,
|
||||
"default": "(CURRENT_TIMESTAMP)"
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
},
|
||||
"watch_status": {
|
||||
"name": "watch_status",
|
||||
"columns": {
|
||||
"device_id": {
|
||||
"name": "device_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"title_id": {
|
||||
"name": "title_id",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"watch_status": {
|
||||
"name": "watch_status",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {
|
||||
"watch_status_device_id_token_device_id_fk": {
|
||||
"name": "watch_status_device_id_token_device_id_fk",
|
||||
"tableFrom": "watch_status",
|
||||
"tableTo": "token",
|
||||
"columnsFrom": ["device_id"],
|
||||
"columnsTo": ["device_id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {
|
||||
"watch_status_device_id_title_id_pk": {
|
||||
"columns": ["device_id", "title_id"],
|
||||
"name": "watch_status_device_id_title_id_pk"
|
||||
}
|
||||
},
|
||||
"uniqueConstraints": {}
|
||||
}
|
||||
},
|
||||
"enums": {},
|
||||
"_meta": {
|
||||
"schemas": {},
|
||||
"tables": {},
|
||||
"columns": {}
|
||||
},
|
||||
"internal": {
|
||||
"indexes": {}
|
||||
}
|
||||
}
|
||||
93
drizzle/meta/0001_snapshot.json
Normal file
93
drizzle/meta/0001_snapshot.json
Normal file
@@ -0,0 +1,93 @@
|
||||
{
|
||||
"version": "6",
|
||||
"dialect": "sqlite",
|
||||
"id": "d5b8fe62-fa26-4e9b-94eb-d3d38701f620",
|
||||
"prevId": "4ecf912c-2ffc-4a17-924b-8694ced4d7b6",
|
||||
"tables": {
|
||||
"token": {
|
||||
"name": "token",
|
||||
"columns": {
|
||||
"device_id": {
|
||||
"name": "device_id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"token": {
|
||||
"name": "token",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"username": {
|
||||
"name": "username",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
},
|
||||
"last_connected_at": {
|
||||
"name": "last_connected_at",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false,
|
||||
"default": "(CURRENT_TIMESTAMP)"
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
},
|
||||
"watch_status": {
|
||||
"name": "watch_status",
|
||||
"columns": {
|
||||
"device_id": {
|
||||
"name": "device_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"title_id": {
|
||||
"name": "title_id",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {
|
||||
"watch_status_device_id_token_device_id_fk": {
|
||||
"name": "watch_status_device_id_token_device_id_fk",
|
||||
"tableFrom": "watch_status",
|
||||
"tableTo": "token",
|
||||
"columnsFrom": ["device_id"],
|
||||
"columnsTo": ["device_id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {
|
||||
"watch_status_device_id_title_id_pk": {
|
||||
"columns": ["device_id", "title_id"],
|
||||
"name": "watch_status_device_id_title_id_pk"
|
||||
}
|
||||
},
|
||||
"uniqueConstraints": {}
|
||||
}
|
||||
},
|
||||
"enums": {},
|
||||
"_meta": {
|
||||
"schemas": {},
|
||||
"tables": {},
|
||||
"columns": {}
|
||||
},
|
||||
"internal": {
|
||||
"indexes": {}
|
||||
}
|
||||
}
|
||||
20
drizzle/meta/_journal.json
Normal file
20
drizzle/meta/_journal.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"version": "7",
|
||||
"dialect": "sqlite",
|
||||
"entries": [
|
||||
{
|
||||
"idx": 0,
|
||||
"version": "6",
|
||||
"when": 1718106156111,
|
||||
"tag": "0000_left_reavers",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 1,
|
||||
"version": "6",
|
||||
"when": 1718107695989,
|
||||
"tag": "0001_purple_franklin_richards",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user