blob: 539cad6456ca0075f45b837b8e676121d88e2952 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
PRAGMA foreign_keys=OFF;--> statement-breakpoint
CREATE TABLE `__new_groceries` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`name` text NOT NULL,
`checked` integer DEFAULT false NOT NULL,
`created_at` text NOT NULL,
`category_id` integer,
FOREIGN KEY (`category_id`) REFERENCES `categories`(`id`) ON UPDATE no action ON DELETE set null
);
--> statement-breakpoint
INSERT INTO `__new_groceries`("id", "name", "checked", "created_at", "category_id") SELECT "id", "name", "checked", "created_at", "category_id" FROM `groceries`;--> statement-breakpoint
DROP TABLE `groceries`;--> statement-breakpoint
ALTER TABLE `__new_groceries` RENAME TO `groceries`;--> statement-breakpoint
PRAGMA foreign_keys=ON;--> statement-breakpoint
CREATE UNIQUE INDEX `groceries_name_unique` ON `groceries` (`name`);
|