@zodic/shared 0.0.11 → 0.0.13

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.
@@ -5,43 +5,8 @@
5
5
  {
6
6
  "idx": 0,
7
7
  "version": "6",
8
- "when": 1733941526291,
9
- "tag": "0000_flowery_meggan",
10
- "breakpoints": true
11
- },
12
- {
13
- "idx": 1,
14
- "version": "6",
15
- "when": 1734826111680,
16
- "tag": "0001_equal_aaron_stack",
17
- "breakpoints": true
18
- },
19
- {
20
- "idx": 2,
21
- "version": "6",
22
- "when": 1734826298520,
23
- "tag": "0002_past_sunspot",
24
- "breakpoints": true
25
- },
26
- {
27
- "idx": 3,
28
- "version": "6",
29
- "when": 1734838305184,
30
- "tag": "0003_swift_pet_avengers",
31
- "breakpoints": true
32
- },
33
- {
34
- "idx": 4,
35
- "version": "6",
36
- "when": 1734838568267,
37
- "tag": "0004_hesitant_katie_power",
38
- "breakpoints": true
39
- },
40
- {
41
- "idx": 5,
42
- "version": "6",
43
- "when": 1734839869486,
44
- "tag": "0005_noisy_marvex",
8
+ "when": 1737425706127,
9
+ "tag": "0000_dusty_green_goblin",
45
10
  "breakpoints": true
46
11
  }
47
12
  ]
package/db/schema.ts CHANGED
@@ -10,17 +10,26 @@ import {
10
10
  export const users = sqliteTable(
11
11
  'users',
12
12
  {
13
- id: text('id')
14
- .primaryKey(),
13
+ id: text('id').primaryKey(),
15
14
  email: text('email').notNull().unique(),
16
15
  name: text('name').notNull(),
17
16
  profileImage: text('profile_image'),
18
17
  userPhotoId: text('user_photo_id'),
19
18
  userPhotoUrl: text('user_photo_url'),
20
19
  gender: text('gender'),
21
- birthDateTime: text('birth_date_time'),
20
+ day: integer('day'), // Day of birth
21
+ month: integer('month'), // Month of birth
22
+ year: integer('year'), // Year of birth
23
+ hour: integer('hour'), // Hour of birth (nullable)
24
+ min: integer('min'), // Minute of birth (nullable)
22
25
  latitude: real('latitude'),
23
26
  longitude: real('longitude'),
27
+ tzone: real('tzone'),
28
+ instagramUsername: text('instagram_username'),
29
+ tiktokUsername: text('instagram_username'),
30
+ credits_balance: integer('credits_balance'),
31
+ totalCreditsEarned: integer('total_credits_earned').default(0),
32
+ lastTransactionAt: integer('last_transaction_at', { mode: 'timestamp' }),
24
33
  createdAt: text('created_at')
25
34
  .default(sql`CURRENT_TIMESTAMP`)
26
35
  .notNull(),
@@ -28,70 +37,228 @@ export const users = sqliteTable(
28
37
  (t) => [index('users_email_idx').on(t.email)]
29
38
  );
30
39
 
31
- export const astrologicalData = sqliteTable(
32
- 'astrological_data',
40
+ export const creditsTransactions = sqliteTable(
41
+ 'credits_transactions',
33
42
  {
34
- id: text('id')
35
- .primaryKey(),
43
+ id: text('id').primaryKey(), // Transaction ID
36
44
  userId: text('user_id')
37
45
  .notNull()
38
46
  .references(() => users.id, { onDelete: 'cascade' }),
39
- planet: text('planet').notNull(), // Planet name (e.g., "Sun", "Moon")
47
+ type: text('type').notNull(), // e.g., "purchase", "spend", "refund"
48
+ amount: integer('amount').notNull(), // Positive for additions, negative for deductions
49
+ description: text('description'), // Optional description (e.g., "Spent on Cosmic Mirror")
50
+ productType: text('product_type'), // e.g., "concept", "artifact", "astrology_report"
51
+ productId: text('product_id'), // Corresponding ID for the product (concept_id, artifact_id, etc.)
52
+ paymentId: text('payment_id'), // References the payment for purchases
53
+ createdAt: integer('created_at', { mode: 'timestamp' }).default(
54
+ sql`CURRENT_TIMESTAMP`
55
+ ),
56
+ },
57
+ (t) => [index('credits_transactions_user_id_idx').on(t.userId)]
58
+ );
59
+
60
+ export const astroPlanets = sqliteTable(
61
+ 'astro_planets',
62
+ {
63
+ id: text('id').primaryKey(),
64
+ userId: text('user_id')
65
+ .notNull()
66
+ .references(() => users.id, { onDelete: 'cascade' }),
67
+ type: text('type').notNull(), // e.g., "planet", "advanced_planet"
68
+ name: text('name').notNull(), // Planet or point name (e.g., "Sun", "Vertex")
40
69
  sign: text('sign').notNull(), // Zodiac sign (e.g., "Sagittarius")
41
70
  house: integer('house').notNull(), // House number (1-12)
42
71
  fullDegree: real('full_degree'), // Full degree in 360° system
43
72
  normDegree: real('norm_degree'), // Degree within the sign (0-29°)
44
73
  speed: real('speed'), // Speed of the planet
45
74
  isRetro: integer('is_retro'), // 0 (false) or 1 (true) for retrograde
75
+ signReport: text('sign_report'), // NEW: Report for the planet's sign
76
+ houseReport: text('house_report'), // NEW: Report for the planet's house
46
77
  },
47
- (t) => [index('astrological_data_user_id_idx').on(t.userId)]
78
+ (t) => [index('astro_planets_user_id_idx').on(t.userId)]
48
79
  );
49
80
 
50
- export const products = sqliteTable(
51
- 'products',
81
+ export const astroHouses = sqliteTable(
82
+ 'astro_houses',
52
83
  {
53
- id: text('id')
54
- .primaryKey(),
55
- name: text('name').unique().notNull(),
56
- description: text('description'),
57
- createdAt: text('created_at')
58
- .default(sql`CURRENT_TIMESTAMP`)
84
+ id: text('id').primaryKey(),
85
+ userId: text('user_id')
86
+ .notNull()
87
+ .references(() => users.id, { onDelete: 'cascade' }),
88
+ house: integer('house').notNull(), // House number (1-12)
89
+ sign: text('sign').notNull(), // Sign ruling the house (e.g., "Sagittarius")
90
+ degree: real('degree').notNull(), // Starting degree of the house
91
+ signReport: text('sign_report'), // NEW: Report for the house's sign
92
+ },
93
+ (t) => [index('astro_houses_user_id_idx').on(t.userId)]
94
+ );
95
+
96
+ export const astroFeatures = sqliteTable(
97
+ 'astro_features',
98
+ {
99
+ id: text('id').primaryKey(),
100
+ userId: text('user_id')
101
+ .notNull()
102
+ .references(() => users.id, { onDelete: 'cascade' }),
103
+ featureType: text('feature_type').notNull(), // e.g., "element", "mode", "moon_phase", "hemisphere", "dominant_sign"
104
+ name: text('name').notNull(), // e.g., "Fire", "Mutable", "First Quarter Moon"
105
+ description: text('description'), // Detailed description
106
+ percentage: real('percentage'), // For elements, modes, dominant sign
107
+ order: integer('order').notNull(), // For consistent display order
108
+ prominentId: integer('prominent_id'), // NEW: Highlighted option index (1-based)
109
+ },
110
+ (t) => [index('astro_features_user_id_idx').on(t.userId)]
111
+ );
112
+
113
+ export const concepts = sqliteTable(
114
+ 'concepts',
115
+ {
116
+ id: text('id').primaryKey(), // Unique Concept ID
117
+ name: text('name').notNull(), // Name of the Concept (e.g., "The Crown", "The Shield")
118
+ slug: text('slug').notNull(), // Name of the Concept (e.g., "crown", "shield")
119
+ planet1: text('planet1').notNull(), // First planet (e.g., "Sun")
120
+ planet2: text('planet2').notNull(), // Second planet (e.g., "Moon")
121
+ planet3: text('planet3'), // Third planet (e.g., "Ascendant"), optional for some Concepts
122
+ },
123
+ (t) => [index('concepts_name_idx').on(t.name)]
124
+ );
125
+
126
+ export const conceptCombinations = sqliteTable(
127
+ 'concept_combinations',
128
+ {
129
+ id: text('id').primaryKey(),
130
+ conceptId: text('concept_id')
131
+ .notNull()
132
+ .references(() => concepts.id, { onDelete: 'cascade' }),
133
+ planet1Sign: text('planet1_sign').notNull(),
134
+ planet2Sign: text('planet2_sign').notNull(),
135
+ planet3Sign: text('planet3_sign').notNull(),
136
+ combinationString: text('combination_string').notNull(), // e.g., "aries-cancer-leo"
137
+ },
138
+ (t) => [
139
+ index('concept_combinations_unique_combination_idx').on(
140
+ t.conceptId,
141
+ t.combinationString
142
+ ),
143
+ ]
144
+ );
145
+
146
+ export const userConcepts = sqliteTable(
147
+ 'user_concepts',
148
+ {
149
+ id: text('id').primaryKey(),
150
+ userId: text('user_id')
151
+ .notNull()
152
+ .references(() => users.id, { onDelete: 'cascade' }),
153
+ conceptId: text('concept_id')
154
+ .notNull()
155
+ .references(() => concepts.id, { onDelete: 'cascade' }),
156
+ conceptCombinationId: text('concept_combination_id')
157
+ .notNull()
158
+ .references(() => conceptCombinations.id, { onDelete: 'cascade' }),
159
+ createdAt: integer('created_at', { mode: 'timestamp' }).default(
160
+ sql`CURRENT_TIMESTAMP`
161
+ ),
162
+ updatedAt: integer('updated_at', { mode: 'timestamp' }).default(
163
+ sql`CURRENT_TIMESTAMP`
164
+ ),
165
+ },
166
+ (t) => [
167
+ index('user_concepts_user_id_idx').on(t.userId),
168
+ index('user_concepts_concept_id_idx').on(t.conceptId),
169
+ ]
170
+ );
171
+
172
+ export const artifacts = sqliteTable(
173
+ 'artifacts',
174
+ {
175
+ id: text('id').primaryKey(),
176
+ name: text('name').notNull(), // Name of the artifact (e.g., "Cosmic Mirror")
177
+ slug: text('slug').notNull(),
178
+ conceptId: text('concept_id')
179
+ .notNull()
180
+ .references(() => concepts.id, { onDelete: 'cascade' }),
181
+ description: text('description').notNull(),
182
+ price: integer('price').notNull(), // Price in credits
183
+ promotionPrice: integer('promotion_price'), // Optional promotional price in credits
184
+ createdAt: integer('created_at', { mode: 'timestamp' }).default(
185
+ sql`CURRENT_TIMESTAMP`
186
+ ),
187
+ },
188
+ (t) => [index('artifacts_concept_id_idx').on(t.conceptId)]
189
+ );
190
+
191
+ export const userArtifacts = sqliteTable(
192
+ 'user_artifacts',
193
+ {
194
+ id: text('id').primaryKey(),
195
+ userId: text('user_id')
196
+ .notNull()
197
+ .references(() => users.id, { onDelete: 'cascade' }),
198
+ artifactId: text('artifact_id')
199
+ .notNull()
200
+ .references(() => artifacts.id, { onDelete: 'cascade' }),
201
+ gender: text('gender').notNull(), // Gender of the user or chosen archetype
202
+ archetypeId: text('archetype_id').notNull(), // Chosen archetype for the artifact
203
+ postImageUrl: text('post_image_url'), // URL for the Instagram post image
204
+ reelImageUrl: text('reel_image_url'), // URL for the Instagram reels/TikTok image
205
+ postGenerationId: text('post_generation_id'), // Leonardo's generation ID for the post image
206
+ reelGenerationId: text('reel_generation_id'), // Leonardo's generation ID for the reel image
207
+ status: text('status')
208
+ .default('pending') // Possible statuses: 'pending', 'post_ready', 'reel_ready', 'completed'
59
209
  .notNull(),
210
+ createdAt: integer('created_at', { mode: 'timestamp' }).default(
211
+ sql`CURRENT_TIMESTAMP`
212
+ ),
213
+ updatedAt: integer('updated_at', { mode: 'timestamp' }).default(
214
+ sql`CURRENT_TIMESTAMP`
215
+ ),
60
216
  },
61
- (t) => [index('products_name_idx').on(t.name)]
217
+ (t) => [
218
+ index('user_artifacts_user_id_idx').on(t.userId),
219
+ index('user_artifacts_artifact_id_idx').on(t.artifactId),
220
+ index('user_artifacts_status_idx').on(t.status),
221
+ ]
62
222
  );
63
223
 
64
224
  export const generations = sqliteTable(
65
225
  'generations',
66
226
  {
67
- id: text('id')
68
- .primaryKey(),
227
+ id: text('id').primaryKey(), // generationId from Leonardo
69
228
  userId: text('user_id')
70
229
  .notNull()
71
230
  .references(() => users.id, { onDelete: 'cascade' }),
72
- productId: text('product_id')
73
- .notNull()
74
- .references(() => products.id, { onDelete: 'set null' }),
75
- type: text('type').notNull(), // Generation type (e.g., "luminous_self", "archetype")
76
- imageId: text('image_id'),
77
- imageUrl: text('image_url'),
78
- reportContent: text('report_content'),
79
- externalSourceUrl: text('external_source_url'),
80
- createdAt: text('created_at').default('CURRENT_TIMESTAMP'),
81
- metadata: text('metadata'),
231
+ artifactId: text('artifact_id').references(() => artifacts.id, {
232
+ onDelete: 'cascade',
233
+ }),
234
+ userArtifactId: text('user_artifact_id').references(
235
+ () => userArtifacts.id,
236
+ { onDelete: 'cascade' }
237
+ ),
238
+ conceptCombinationId: text('concept_combination_id').references(
239
+ () => conceptCombinations.id,
240
+ { onDelete: 'cascade' }
241
+ ),
242
+ type: text('type').notNull(), // e.g., "concept_image"
243
+ status: text('status').default('pending').notNull(), // "pending", "completed", "failed"
244
+ url: text('url'), // URL for the generated image
245
+ createdAt: integer('created_at', { mode: 'timestamp' }).default(
246
+ sql`CURRENT_TIMESTAMP`
247
+ ),
248
+ updatedAt: integer('updated_at', { mode: 'timestamp' }).default(
249
+ sql`CURRENT_TIMESTAMP`
250
+ ),
82
251
  },
83
252
  (t) => [
84
253
  index('generations_user_id_idx').on(t.userId),
85
- index('generations_product_id_idx').on(t.productId),
86
- index('generations_user_id_product_id_idx').on(t.userId, t.productId),
254
+ index('generations_concept_combination_id_idx').on(t.conceptCombinationId),
87
255
  ]
88
256
  );
89
257
 
90
258
  export const tokens = sqliteTable(
91
259
  'tokens',
92
260
  {
93
- id: text('id')
94
- .primaryKey(),
261
+ id: text('id').primaryKey(),
95
262
  userId: text('user_id')
96
263
  .notNull()
97
264
  .references(() => users.id, { onDelete: 'cascade' }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodic/shared",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -19,4 +19,102 @@ export type AstroEntity = {
19
19
  norm_degree: number;
20
20
  sign: string;
21
21
  house: number;
22
+ };
23
+
24
+ export type NatalChartInterpretation = {
25
+ planets: Planet[];
26
+ houses: House[];
27
+ ascendant: number;
28
+ midheaven: number;
29
+ vertex: number;
30
+ lilith: Lilith;
31
+ aspects: Aspect[];
32
+ moon_phase: MoonPhase;
33
+ hemisphere: Hemisphere;
34
+ elements: Elements;
35
+ modes: Modes;
36
+ dominant_sign: DominantSign;
37
+ };
38
+
39
+ export type Planet = {
40
+ name: string;
41
+ full_degree: number;
42
+ norm_degree: number;
43
+ speed: number;
44
+ is_retro: string; // Can also be boolean if converted
45
+ sign_id: number;
46
+ sign: string;
47
+ house: number;
48
+ };
49
+
50
+ export type House = {
51
+ house: number;
52
+ sign: string;
53
+ degree: number;
54
+ };
55
+
56
+ export type Lilith = {
57
+ name: string;
58
+ full_degree: number;
59
+ norm_degree: number;
60
+ speed: number;
61
+ is_retro: string; // Can also be boolean if converted
62
+ sign_id: number;
63
+ sign: string;
64
+ house: number;
65
+ };
66
+
67
+ export type Aspect = {
68
+ aspecting_planet: string;
69
+ aspected_planet: string;
70
+ aspecting_planet_id: number;
71
+ aspected_planet_id: number;
72
+ type: string;
73
+ orb: number;
74
+ diff: number;
75
+ };
76
+
77
+ export type MoonPhase = {
78
+ moon_phase_name: string;
79
+ moon_phase_id: number;
80
+ moon_phase_calc: string;
81
+ moon_phase_description: string;
82
+ };
83
+
84
+ export type Hemisphere = {
85
+ east_west: HemisphereDetail;
86
+ north_south: HemisphereDetail;
87
+ };
88
+
89
+ export type HemisphereDetail = {
90
+ description: string;
91
+ id: number;
92
+ };
93
+
94
+ export type Elements = {
95
+ elements: Element[];
96
+ description: string;
97
+ dominant_element_id: number;
98
+ };
99
+
100
+ export type Element = {
101
+ name: string;
102
+ percentage: number;
103
+ };
104
+
105
+ export type Modes = {
106
+ modes: Mode[];
107
+ description: string;
108
+ dominant_mode_id: number;
109
+ };
110
+
111
+ export type Mode = {
112
+ name: string;
113
+ percentage: number;
114
+ };
115
+
116
+ export type DominantSign = {
117
+ sign_id: number;
118
+ sign_name: string;
119
+ percentage: number;
22
120
  };
package/bun.lockb DELETED
Binary file
@@ -1,20 +0,0 @@
1
- CREATE TABLE `tokens` (
2
- `id` text PRIMARY KEY NOT NULL,
3
- `user_id` text NOT NULL,
4
- `refresh_token` text NOT NULL,
5
- `created_at` text DEFAULT 'CURRENT_TIMESTAMP'
6
- );
7
- --> statement-breakpoint
8
- CREATE TABLE `users_table` (
9
- `id` text PRIMARY KEY NOT NULL,
10
- `name` text NOT NULL,
11
- `age` integer NOT NULL,
12
- `email` text NOT NULL,
13
- `birthday` text,
14
- `birth_time` text,
15
- `crown` text,
16
- `createdAt` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
17
- `updatedAt` text DEFAULT CURRENT_TIMESTAMP
18
- );
19
- --> statement-breakpoint
20
- CREATE UNIQUE INDEX `users_table_email_unique` ON `users_table` (`email`);
@@ -1,79 +0,0 @@
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`);
@@ -1,21 +0,0 @@
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`);
@@ -1,71 +0,0 @@
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`);