Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions apps/backend/drizzle/0003_high_makkari.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
PRAGMA foreign_keys=OFF;--> statement-breakpoint
CREATE TABLE `__new_downloads` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`torrent_filename` text NOT NULL,
`peer_id` text NOT NULL,
`peer_name` text NOT NULL,
`item_id` text NOT NULL,
`filename` text NOT NULL,
`dest_path` text NOT NULL,
`part_path` text NOT NULL,
`release_size` integer NOT NULL,
`release_json` text NOT NULL,
`expected_bytes` integer,
`expected_bytes_source` text,
`expected_bytes_mismatch` integer DEFAULT false NOT NULL,
`downloaded_bytes` integer DEFAULT 0 NOT NULL,
`attempts` integer DEFAULT 0 NOT NULL,
`status` text NOT NULL,
`started_at` text NOT NULL,
`updated_at` text NOT NULL,
`completed_at` text,
`error` text,
`qb_category` text,
`qb_source_server` text,
CONSTRAINT "downloads_status_check" CHECK("__new_downloads"."status" in ('downloading', 'completed', 'failed', 'import_queued')),
CONSTRAINT "downloads_expected_bytes_source_check" CHECK("__new_downloads"."expected_bytes_source" is null or "__new_downloads"."expected_bytes_source" in ('content_length', 'release_size'))
);
--> statement-breakpoint
INSERT INTO `__new_downloads`("id", "torrent_filename", "peer_id", "peer_name", "item_id", "filename", "dest_path", "part_path", "release_size", "release_json", "expected_bytes", "expected_bytes_source", "expected_bytes_mismatch", "downloaded_bytes", "attempts", "status", "started_at", "updated_at", "completed_at", "error", "qb_category", "qb_source_server") SELECT "id", "torrent_filename", "peer_id", "peer_name", "item_id", "filename", "dest_path", "part_path", "release_size", "release_json", "expected_bytes", "expected_bytes_source", "expected_bytes_mismatch", "downloaded_bytes", "attempts", "status", "started_at", "updated_at", "completed_at", "error", "qb_category", "qb_source_server" FROM `downloads`;--> statement-breakpoint
DROP TABLE `downloads`;--> statement-breakpoint
ALTER TABLE `__new_downloads` RENAME TO `downloads`;--> statement-breakpoint
PRAGMA foreign_keys=ON;--> statement-breakpoint
CREATE INDEX `downloads_status_idx` ON `downloads` (`status`);--> statement-breakpoint
CREATE INDEX `downloads_updated_at_idx` ON `downloads` (`updated_at`);
34 changes: 34 additions & 0 deletions apps/backend/drizzle/0004_sleepy_retro_girl.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
PRAGMA foreign_keys=OFF;--> statement-breakpoint
CREATE TABLE `__new_downloads` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`torrent_filename` text NOT NULL,
`peer_id` text NOT NULL,
`peer_name` text NOT NULL,
`item_id` text NOT NULL,
`filename` text NOT NULL,
`dest_path` text NOT NULL,
`part_path` text NOT NULL,
`release_size` integer NOT NULL,
`release_json` text NOT NULL,
`expected_bytes` integer,
`expected_bytes_source` text,
`expected_bytes_mismatch` integer DEFAULT false NOT NULL,
`downloaded_bytes` integer DEFAULT 0 NOT NULL,
`attempts` integer DEFAULT 0 NOT NULL,
`status` text NOT NULL,
`started_at` text NOT NULL,
`updated_at` text NOT NULL,
`completed_at` text,
`error` text,
`qb_category` text,
`qb_source_server` text,
CONSTRAINT "downloads_status_check" CHECK("__new_downloads"."status" in ('downloading', 'completed', 'failed', 'import_queued')),
CONSTRAINT "downloads_expected_bytes_source_check" CHECK("__new_downloads"."expected_bytes_source" is null or "__new_downloads"."expected_bytes_source" in ('content_length', 'content_range', 'release_size'))
);
--> statement-breakpoint
INSERT INTO `__new_downloads`("id", "torrent_filename", "peer_id", "peer_name", "item_id", "filename", "dest_path", "part_path", "release_size", "release_json", "expected_bytes", "expected_bytes_source", "expected_bytes_mismatch", "downloaded_bytes", "attempts", "status", "started_at", "updated_at", "completed_at", "error", "qb_category", "qb_source_server") SELECT "id", "torrent_filename", "peer_id", "peer_name", "item_id", "filename", "dest_path", "part_path", "release_size", "release_json", "expected_bytes", "expected_bytes_source", "expected_bytes_mismatch", "downloaded_bytes", "attempts", "status", "started_at", "updated_at", "completed_at", "error", "qb_category", "qb_source_server" FROM `downloads`;--> statement-breakpoint
DROP TABLE `downloads`;--> statement-breakpoint
ALTER TABLE `__new_downloads` RENAME TO `downloads`;--> statement-breakpoint
PRAGMA foreign_keys=ON;--> statement-breakpoint
CREATE INDEX `downloads_status_idx` ON `downloads` (`status`);--> statement-breakpoint
CREATE INDEX `downloads_updated_at_idx` ON `downloads` (`updated_at`);
209 changes: 209 additions & 0 deletions apps/backend/drizzle/meta/0003_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
{
"version": "6",
"dialect": "sqlite",
"id": "6c9640c3-d5d1-4bd2-82e3-bc067ea7f95f",
"prevId": "5fc3b7b0-f29c-475e-937f-e87648e8bf40",
"tables": {
"downloads": {
"name": "downloads",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"torrent_filename": {
"name": "torrent_filename",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"peer_id": {
"name": "peer_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"peer_name": {
"name": "peer_name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"item_id": {
"name": "item_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"filename": {
"name": "filename",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"dest_path": {
"name": "dest_path",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"part_path": {
"name": "part_path",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"release_size": {
"name": "release_size",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"release_json": {
"name": "release_json",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"expected_bytes": {
"name": "expected_bytes",
"type": "integer",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"expected_bytes_source": {
"name": "expected_bytes_source",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"expected_bytes_mismatch": {
"name": "expected_bytes_mismatch",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": false
},
"downloaded_bytes": {
"name": "downloaded_bytes",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 0
},
"attempts": {
"name": "attempts",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 0
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"started_at": {
"name": "started_at",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"completed_at": {
"name": "completed_at",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"error": {
"name": "error",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"qb_category": {
"name": "qb_category",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"qb_source_server": {
"name": "qb_source_server",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
}
},
"indexes": {
"downloads_status_idx": {
"name": "downloads_status_idx",
"columns": [
"status"
],
"isUnique": false
},
"downloads_updated_at_idx": {
"name": "downloads_updated_at_idx",
"columns": [
"updated_at"
],
"isUnique": false
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {
"downloads_status_check": {
"name": "downloads_status_check",
"value": "\"downloads\".\"status\" in ('downloading', 'completed', 'failed', 'import_queued')"
},
"downloads_expected_bytes_source_check": {
"name": "downloads_expected_bytes_source_check",
"value": "\"downloads\".\"expected_bytes_source\" is null or \"downloads\".\"expected_bytes_source\" in ('content_length', 'release_size')"
}
}
}
},
"views": {},
"enums": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
},
"internal": {
"indexes": {}
}
}
Loading
Loading