@zodic/shared 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/db/migrations/0001_equal_aaron_stack.sql +79 -0
- package/db/migrations/0002_past_sunspot.sql +21 -0
- package/db/migrations/0003_swift_pet_avengers.sql +71 -0
- package/db/migrations/0004_hesitant_katie_power.sql +71 -0
- package/db/migrations/0005_noisy_marvex.sql +19 -0
- package/db/migrations/meta/0001_snapshot.json +480 -0
- package/db/migrations/meta/0002_snapshot.json +476 -0
- package/db/migrations/meta/0003_snapshot.json +480 -0
- package/db/migrations/meta/0004_snapshot.json +476 -0
- package/db/migrations/meta/0005_snapshot.json +476 -0
- package/db/migrations/meta/_journal.json +35 -0
- package/db/schema.ts +18 -13
- package/drizzle.config.ts +1 -0
- package/middleware/index.ts +11 -5
- package/package.json +4 -2
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
ALTER TABLE `users_table` RENAME TO `users`;--> statement-breakpoint
|
|
2
|
+
ALTER TABLE `users` RENAME COLUMN "birth_time" TO "birth_date_time";--> statement-breakpoint
|
|
3
|
+
CREATE TABLE `astrological_data` (
|
|
4
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
5
|
+
`user_id` text NOT NULL,
|
|
6
|
+
`planet` text NOT NULL,
|
|
7
|
+
`sign` text NOT NULL,
|
|
8
|
+
`house` integer NOT NULL,
|
|
9
|
+
`full_degree` real NOT NULL,
|
|
10
|
+
`norm_degree` real NOT NULL,
|
|
11
|
+
`speed` real NOT NULL,
|
|
12
|
+
`is_retro` integer NOT NULL,
|
|
13
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
14
|
+
);
|
|
15
|
+
--> statement-breakpoint
|
|
16
|
+
CREATE INDEX `astrological_data_user_id_idx` ON `astrological_data` (`user_id`);--> statement-breakpoint
|
|
17
|
+
CREATE TABLE `generations` (
|
|
18
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
19
|
+
`user_id` text NOT NULL,
|
|
20
|
+
`product_id` text NOT NULL,
|
|
21
|
+
`type` text NOT NULL,
|
|
22
|
+
`image_id` text,
|
|
23
|
+
`image_url` text,
|
|
24
|
+
`report_content` text,
|
|
25
|
+
`external_source_url` text,
|
|
26
|
+
`created_at` text DEFAULT 'CURRENT_TIMESTAMP',
|
|
27
|
+
`metadata` text,
|
|
28
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
29
|
+
FOREIGN KEY (`product_id`) REFERENCES `products`(`id`) ON UPDATE no action ON DELETE set null
|
|
30
|
+
);
|
|
31
|
+
--> statement-breakpoint
|
|
32
|
+
CREATE INDEX `generations_user_id_idx` ON `generations` (`user_id`);--> statement-breakpoint
|
|
33
|
+
CREATE INDEX `generations_product_id_idx` ON `generations` (`product_id`);--> statement-breakpoint
|
|
34
|
+
CREATE INDEX `generations_user_id_product_id_idx` ON `generations` (`user_id`,`product_id`);--> statement-breakpoint
|
|
35
|
+
CREATE TABLE `products` (
|
|
36
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
37
|
+
`name` text NOT NULL,
|
|
38
|
+
`description` text,
|
|
39
|
+
`created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
40
|
+
);
|
|
41
|
+
--> statement-breakpoint
|
|
42
|
+
CREATE UNIQUE INDEX `products_name_unique` ON `products` (`name`);--> statement-breakpoint
|
|
43
|
+
CREATE INDEX `products_name_idx` ON `products` (`name`);--> statement-breakpoint
|
|
44
|
+
DROP INDEX `users_table_email_unique`;--> statement-breakpoint
|
|
45
|
+
PRAGMA foreign_keys=OFF;--> statement-breakpoint
|
|
46
|
+
CREATE TABLE `__new_users` (
|
|
47
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
48
|
+
`email` text NOT NULL,
|
|
49
|
+
`name` text NOT NULL,
|
|
50
|
+
`profile_image` text,
|
|
51
|
+
`user_photo_id` text,
|
|
52
|
+
`user_photo_url` text,
|
|
53
|
+
`gender` text,
|
|
54
|
+
`birth_date_time` text NOT NULL,
|
|
55
|
+
`latitude` real NOT NULL,
|
|
56
|
+
`longitude` real NOT NULL,
|
|
57
|
+
`created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
58
|
+
);
|
|
59
|
+
--> statement-breakpoint
|
|
60
|
+
INSERT INTO `__new_users`("id", "email", "name", "profile_image", "user_photo_id", "user_photo_url", "gender", "birth_date_time", "latitude", "longitude", "created_at") SELECT "id", "email", "name", "profile_image", "user_photo_id", "user_photo_url", "gender", "birth_date_time", "latitude", "longitude", "created_at" FROM `users`;--> statement-breakpoint
|
|
61
|
+
DROP TABLE `users`;--> statement-breakpoint
|
|
62
|
+
ALTER TABLE `__new_users` RENAME TO `users`;--> statement-breakpoint
|
|
63
|
+
PRAGMA foreign_keys=ON;--> statement-breakpoint
|
|
64
|
+
CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);--> statement-breakpoint
|
|
65
|
+
CREATE INDEX `users_email_idx` ON `users` (`email`);--> statement-breakpoint
|
|
66
|
+
CREATE TABLE `__new_tokens` (
|
|
67
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
68
|
+
`user_id` text NOT NULL,
|
|
69
|
+
`refresh_token` text NOT NULL,
|
|
70
|
+
`expires_at` text NOT NULL,
|
|
71
|
+
`created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
72
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
73
|
+
);
|
|
74
|
+
--> statement-breakpoint
|
|
75
|
+
INSERT INTO `__new_tokens`("id", "user_id", "refresh_token", "expires_at", "created_at") SELECT "id", "user_id", "refresh_token", "expires_at", "created_at" FROM `tokens`;--> statement-breakpoint
|
|
76
|
+
DROP TABLE `tokens`;--> statement-breakpoint
|
|
77
|
+
ALTER TABLE `__new_tokens` RENAME TO `tokens`;--> statement-breakpoint
|
|
78
|
+
CREATE UNIQUE INDEX `tokens_refresh_token_unique` ON `tokens` (`refresh_token`);--> statement-breakpoint
|
|
79
|
+
CREATE INDEX `tokens_user_id_idx` ON `tokens` (`user_id`);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
PRAGMA foreign_keys=OFF;--> statement-breakpoint
|
|
2
|
+
CREATE TABLE `__new_users` (
|
|
3
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
4
|
+
`email` text NOT NULL,
|
|
5
|
+
`name` text NOT NULL,
|
|
6
|
+
`profile_image` text,
|
|
7
|
+
`user_photo_id` text,
|
|
8
|
+
`user_photo_url` text,
|
|
9
|
+
`gender` text,
|
|
10
|
+
`birth_date_time` text,
|
|
11
|
+
`latitude` real,
|
|
12
|
+
`longitude` real,
|
|
13
|
+
`created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
14
|
+
);
|
|
15
|
+
--> statement-breakpoint
|
|
16
|
+
INSERT INTO `__new_users`("id", "email", "name", "profile_image", "user_photo_id", "user_photo_url", "gender", "birth_date_time", "latitude", "longitude", "created_at") SELECT "id", "email", "name", "profile_image", "user_photo_id", "user_photo_url", "gender", "birth_date_time", "latitude", "longitude", "created_at" FROM `users`;--> statement-breakpoint
|
|
17
|
+
DROP TABLE `users`;--> statement-breakpoint
|
|
18
|
+
ALTER TABLE `__new_users` RENAME TO `users`;--> statement-breakpoint
|
|
19
|
+
PRAGMA foreign_keys=ON;--> statement-breakpoint
|
|
20
|
+
CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);--> statement-breakpoint
|
|
21
|
+
CREATE INDEX `users_email_idx` ON `users` (`email`);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
PRAGMA foreign_keys=OFF;--> statement-breakpoint
|
|
2
|
+
CREATE TABLE `__new_astrological_data` (
|
|
3
|
+
`id` text PRIMARY KEY DEFAULT lower(hex(randomblob(16))) NOT NULL,
|
|
4
|
+
`user_id` text NOT NULL,
|
|
5
|
+
`planet` text NOT NULL,
|
|
6
|
+
`sign` text NOT NULL,
|
|
7
|
+
`house` integer NOT NULL,
|
|
8
|
+
`full_degree` real NOT NULL,
|
|
9
|
+
`norm_degree` real NOT NULL,
|
|
10
|
+
`speed` real NOT NULL,
|
|
11
|
+
`is_retro` integer NOT NULL,
|
|
12
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
13
|
+
);
|
|
14
|
+
--> statement-breakpoint
|
|
15
|
+
INSERT INTO `__new_astrological_data`("id", "user_id", "planet", "sign", "house", "full_degree", "norm_degree", "speed", "is_retro") SELECT "id", "user_id", "planet", "sign", "house", "full_degree", "norm_degree", "speed", "is_retro" FROM `astrological_data`;--> statement-breakpoint
|
|
16
|
+
DROP TABLE `astrological_data`;--> statement-breakpoint
|
|
17
|
+
ALTER TABLE `__new_astrological_data` RENAME TO `astrological_data`;--> statement-breakpoint
|
|
18
|
+
PRAGMA foreign_keys=ON;--> statement-breakpoint
|
|
19
|
+
CREATE INDEX `astrological_data_user_id_idx` ON `astrological_data` (`user_id`);--> statement-breakpoint
|
|
20
|
+
CREATE TABLE `__new_generations` (
|
|
21
|
+
`id` text PRIMARY KEY DEFAULT lower(hex(randomblob(16))) NOT NULL,
|
|
22
|
+
`user_id` text NOT NULL,
|
|
23
|
+
`product_id` text NOT NULL,
|
|
24
|
+
`type` text NOT NULL,
|
|
25
|
+
`image_id` text,
|
|
26
|
+
`image_url` text,
|
|
27
|
+
`report_content` text,
|
|
28
|
+
`external_source_url` text,
|
|
29
|
+
`created_at` text DEFAULT 'CURRENT_TIMESTAMP',
|
|
30
|
+
`metadata` text,
|
|
31
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
32
|
+
FOREIGN KEY (`product_id`) REFERENCES `products`(`id`) ON UPDATE no action ON DELETE set null
|
|
33
|
+
);
|
|
34
|
+
--> statement-breakpoint
|
|
35
|
+
INSERT INTO `__new_generations`("id", "user_id", "product_id", "type", "image_id", "image_url", "report_content", "external_source_url", "created_at", "metadata") SELECT "id", "user_id", "product_id", "type", "image_id", "image_url", "report_content", "external_source_url", "created_at", "metadata" FROM `generations`;--> statement-breakpoint
|
|
36
|
+
DROP TABLE `generations`;--> statement-breakpoint
|
|
37
|
+
ALTER TABLE `__new_generations` RENAME TO `generations`;--> statement-breakpoint
|
|
38
|
+
CREATE INDEX `generations_user_id_idx` ON `generations` (`user_id`);--> statement-breakpoint
|
|
39
|
+
CREATE INDEX `generations_product_id_idx` ON `generations` (`product_id`);--> statement-breakpoint
|
|
40
|
+
CREATE INDEX `generations_user_id_product_id_idx` ON `generations` (`user_id`,`product_id`);--> statement-breakpoint
|
|
41
|
+
CREATE TABLE `__new_products` (
|
|
42
|
+
`id` text PRIMARY KEY DEFAULT lower(hex(randomblob(16))) NOT NULL,
|
|
43
|
+
`name` text NOT NULL,
|
|
44
|
+
`description` text,
|
|
45
|
+
`created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
46
|
+
);
|
|
47
|
+
--> statement-breakpoint
|
|
48
|
+
INSERT INTO `__new_products`("id", "name", "description", "created_at") SELECT "id", "name", "description", "created_at" FROM `products`;--> statement-breakpoint
|
|
49
|
+
DROP TABLE `products`;--> statement-breakpoint
|
|
50
|
+
ALTER TABLE `__new_products` RENAME TO `products`;--> statement-breakpoint
|
|
51
|
+
CREATE UNIQUE INDEX `products_name_unique` ON `products` (`name`);--> statement-breakpoint
|
|
52
|
+
CREATE INDEX `products_name_idx` ON `products` (`name`);--> statement-breakpoint
|
|
53
|
+
CREATE TABLE `__new_users` (
|
|
54
|
+
`id` text PRIMARY KEY DEFAULT lower(hex(randomblob(16))) NOT NULL,
|
|
55
|
+
`email` text NOT NULL,
|
|
56
|
+
`name` text NOT NULL,
|
|
57
|
+
`profile_image` text,
|
|
58
|
+
`user_photo_id` text,
|
|
59
|
+
`user_photo_url` text,
|
|
60
|
+
`gender` text,
|
|
61
|
+
`birth_date_time` text,
|
|
62
|
+
`latitude` real,
|
|
63
|
+
`longitude` real,
|
|
64
|
+
`created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
65
|
+
);
|
|
66
|
+
--> statement-breakpoint
|
|
67
|
+
INSERT INTO `__new_users`("id", "email", "name", "profile_image", "user_photo_id", "user_photo_url", "gender", "birth_date_time", "latitude", "longitude", "created_at") SELECT "id", "email", "name", "profile_image", "user_photo_id", "user_photo_url", "gender", "birth_date_time", "latitude", "longitude", "created_at" FROM `users`;--> statement-breakpoint
|
|
68
|
+
DROP TABLE `users`;--> statement-breakpoint
|
|
69
|
+
ALTER TABLE `__new_users` RENAME TO `users`;--> statement-breakpoint
|
|
70
|
+
CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);--> statement-breakpoint
|
|
71
|
+
CREATE INDEX `users_email_idx` ON `users` (`email`);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
PRAGMA foreign_keys=OFF;--> statement-breakpoint
|
|
2
|
+
CREATE TABLE `__new_astrological_data` (
|
|
3
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
4
|
+
`user_id` text NOT NULL,
|
|
5
|
+
`planet` text NOT NULL,
|
|
6
|
+
`sign` text NOT NULL,
|
|
7
|
+
`house` integer NOT NULL,
|
|
8
|
+
`full_degree` real NOT NULL,
|
|
9
|
+
`norm_degree` real NOT NULL,
|
|
10
|
+
`speed` real NOT NULL,
|
|
11
|
+
`is_retro` integer NOT NULL,
|
|
12
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
13
|
+
);
|
|
14
|
+
--> statement-breakpoint
|
|
15
|
+
INSERT INTO `__new_astrological_data`("id", "user_id", "planet", "sign", "house", "full_degree", "norm_degree", "speed", "is_retro") SELECT "id", "user_id", "planet", "sign", "house", "full_degree", "norm_degree", "speed", "is_retro" FROM `astrological_data`;--> statement-breakpoint
|
|
16
|
+
DROP TABLE `astrological_data`;--> statement-breakpoint
|
|
17
|
+
ALTER TABLE `__new_astrological_data` RENAME TO `astrological_data`;--> statement-breakpoint
|
|
18
|
+
PRAGMA foreign_keys=ON;--> statement-breakpoint
|
|
19
|
+
CREATE INDEX `astrological_data_user_id_idx` ON `astrological_data` (`user_id`);--> statement-breakpoint
|
|
20
|
+
CREATE TABLE `__new_generations` (
|
|
21
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
22
|
+
`user_id` text NOT NULL,
|
|
23
|
+
`product_id` text NOT NULL,
|
|
24
|
+
`type` text NOT NULL,
|
|
25
|
+
`image_id` text,
|
|
26
|
+
`image_url` text,
|
|
27
|
+
`report_content` text,
|
|
28
|
+
`external_source_url` text,
|
|
29
|
+
`created_at` text DEFAULT 'CURRENT_TIMESTAMP',
|
|
30
|
+
`metadata` text,
|
|
31
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
32
|
+
FOREIGN KEY (`product_id`) REFERENCES `products`(`id`) ON UPDATE no action ON DELETE set null
|
|
33
|
+
);
|
|
34
|
+
--> statement-breakpoint
|
|
35
|
+
INSERT INTO `__new_generations`("id", "user_id", "product_id", "type", "image_id", "image_url", "report_content", "external_source_url", "created_at", "metadata") SELECT "id", "user_id", "product_id", "type", "image_id", "image_url", "report_content", "external_source_url", "created_at", "metadata" FROM `generations`;--> statement-breakpoint
|
|
36
|
+
DROP TABLE `generations`;--> statement-breakpoint
|
|
37
|
+
ALTER TABLE `__new_generations` RENAME TO `generations`;--> statement-breakpoint
|
|
38
|
+
CREATE INDEX `generations_user_id_idx` ON `generations` (`user_id`);--> statement-breakpoint
|
|
39
|
+
CREATE INDEX `generations_product_id_idx` ON `generations` (`product_id`);--> statement-breakpoint
|
|
40
|
+
CREATE INDEX `generations_user_id_product_id_idx` ON `generations` (`user_id`,`product_id`);--> statement-breakpoint
|
|
41
|
+
CREATE TABLE `__new_products` (
|
|
42
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
43
|
+
`name` text NOT NULL,
|
|
44
|
+
`description` text,
|
|
45
|
+
`created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
46
|
+
);
|
|
47
|
+
--> statement-breakpoint
|
|
48
|
+
INSERT INTO `__new_products`("id", "name", "description", "created_at") SELECT "id", "name", "description", "created_at" FROM `products`;--> statement-breakpoint
|
|
49
|
+
DROP TABLE `products`;--> statement-breakpoint
|
|
50
|
+
ALTER TABLE `__new_products` RENAME TO `products`;--> statement-breakpoint
|
|
51
|
+
CREATE UNIQUE INDEX `products_name_unique` ON `products` (`name`);--> statement-breakpoint
|
|
52
|
+
CREATE INDEX `products_name_idx` ON `products` (`name`);--> statement-breakpoint
|
|
53
|
+
CREATE TABLE `__new_users` (
|
|
54
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
55
|
+
`email` text NOT NULL,
|
|
56
|
+
`name` text NOT NULL,
|
|
57
|
+
`profile_image` text,
|
|
58
|
+
`user_photo_id` text,
|
|
59
|
+
`user_photo_url` text,
|
|
60
|
+
`gender` text,
|
|
61
|
+
`birth_date_time` text,
|
|
62
|
+
`latitude` real,
|
|
63
|
+
`longitude` real,
|
|
64
|
+
`created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
65
|
+
);
|
|
66
|
+
--> statement-breakpoint
|
|
67
|
+
INSERT INTO `__new_users`("id", "email", "name", "profile_image", "user_photo_id", "user_photo_url", "gender", "birth_date_time", "latitude", "longitude", "created_at") SELECT "id", "email", "name", "profile_image", "user_photo_id", "user_photo_url", "gender", "birth_date_time", "latitude", "longitude", "created_at" FROM `users`;--> statement-breakpoint
|
|
68
|
+
DROP TABLE `users`;--> statement-breakpoint
|
|
69
|
+
ALTER TABLE `__new_users` RENAME TO `users`;--> statement-breakpoint
|
|
70
|
+
CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);--> statement-breakpoint
|
|
71
|
+
CREATE INDEX `users_email_idx` ON `users` (`email`);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
PRAGMA foreign_keys=OFF;--> statement-breakpoint
|
|
2
|
+
CREATE TABLE `__new_astrological_data` (
|
|
3
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
4
|
+
`user_id` text NOT NULL,
|
|
5
|
+
`planet` text NOT NULL,
|
|
6
|
+
`sign` text NOT NULL,
|
|
7
|
+
`house` integer NOT NULL,
|
|
8
|
+
`full_degree` real,
|
|
9
|
+
`norm_degree` real,
|
|
10
|
+
`speed` real,
|
|
11
|
+
`is_retro` integer,
|
|
12
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
13
|
+
);
|
|
14
|
+
--> statement-breakpoint
|
|
15
|
+
INSERT INTO `__new_astrological_data`("id", "user_id", "planet", "sign", "house", "full_degree", "norm_degree", "speed", "is_retro") SELECT "id", "user_id", "planet", "sign", "house", "full_degree", "norm_degree", "speed", "is_retro" FROM `astrological_data`;--> statement-breakpoint
|
|
16
|
+
DROP TABLE `astrological_data`;--> statement-breakpoint
|
|
17
|
+
ALTER TABLE `__new_astrological_data` RENAME TO `astrological_data`;--> statement-breakpoint
|
|
18
|
+
PRAGMA foreign_keys=ON;--> statement-breakpoint
|
|
19
|
+
CREATE INDEX `astrological_data_user_id_idx` ON `astrological_data` (`user_id`);
|