-
-
Notifications
You must be signed in to change notification settings - Fork 6
update drizzle?? #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
update drizzle?? #111
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b792a70
update dependencies and add migration for post_images and url_metadat…
LadyBluenotes 732be1e
Update pnpm-workspace.yaml
LadyBluenotes 7a03af5
update database relations and update query syntax for new version of …
LadyBluenotes 7b07e48
add relations to drizzle initialization in client.ts
LadyBluenotes 29e6f0b
update lock file
LadyBluenotes 22731aa
Merge branch 'playfulprogramming:main' into drizzle-up
LadyBluenotes 3243b80
chore: update lockfile and PNPM
crutchcorn 8e09240
remove drizzle-orm dependency from apps/api
fennifith d5bf097
Merge branch 'main' into fork-ladybluenotes/drizzle-up
fennifith 4a336b1
modify drizzle migrations to run over prod db
fennifith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
packages/db/drizzle/0000_gigantic_epoch.sql → ...250619151208_gigantic_epoch/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
212 changes: 212 additions & 0 deletions
212
packages/db/drizzle/20250619151208_gigantic_epoch/snapshot.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,212 @@ | ||
| { | ||
| "id": "c9e5f7d0-b17b-4966-b2aa-6d9392ba97d6", | ||
| "prevIds": [ | ||
| "00000000-0000-0000-0000-000000000000" | ||
| ], | ||
| "version": "8", | ||
| "dialect": "postgres", | ||
| "ddl": [ | ||
| { | ||
| "isRlsEnabled": false, | ||
| "name": "post_images", | ||
| "schema": "public", | ||
| "entityType": "tables" | ||
| }, | ||
| { | ||
| "columns": [ | ||
| "slug" | ||
| ], | ||
| "nameExplicit": false, | ||
| "name": "post_images_pkey", | ||
| "schema": "public", | ||
| "table": "post_images", | ||
| "entityType": "pks" | ||
| }, | ||
| { | ||
| "type": "varchar(2048)", | ||
| "typeSchema": null, | ||
| "notNull": true, | ||
| "dimensions": 0, | ||
| "default": null, | ||
| "generated": null, | ||
| "identity": null, | ||
| "name": "slug", | ||
| "schema": "public", | ||
| "table": "post_images", | ||
| "entityType": "columns" | ||
| }, | ||
| { | ||
| "type": "varchar(2048)", | ||
| "typeSchema": null, | ||
| "notNull": true, | ||
| "dimensions": 0, | ||
| "default": null, | ||
| "generated": null, | ||
| "identity": null, | ||
| "name": "banner_key", | ||
| "schema": "public", | ||
| "table": "post_images", | ||
| "entityType": "columns" | ||
| }, | ||
| { | ||
| "type": "varchar(2048)", | ||
| "typeSchema": null, | ||
| "notNull": true, | ||
| "dimensions": 0, | ||
| "default": null, | ||
| "generated": null, | ||
| "identity": null, | ||
| "name": "link_preview_key", | ||
| "schema": "public", | ||
| "table": "post_images", | ||
| "entityType": "columns" | ||
| }, | ||
| { | ||
| "isRlsEnabled": false, | ||
| "name": "url_metadata", | ||
| "schema": "public", | ||
| "entityType": "tables" | ||
| }, | ||
| { | ||
| "columns": [ | ||
| "url" | ||
| ], | ||
| "nameExplicit": false, | ||
| "name": "url_metadata_pkey", | ||
| "schema": "public", | ||
| "table": "url_metadata", | ||
| "entityType": "pks" | ||
| }, | ||
| { | ||
| "type": "varchar(2048)", | ||
| "typeSchema": null, | ||
| "notNull": true, | ||
| "dimensions": 0, | ||
| "default": null, | ||
| "generated": null, | ||
| "identity": null, | ||
| "name": "url", | ||
| "schema": "public", | ||
| "table": "url_metadata", | ||
| "entityType": "columns" | ||
| }, | ||
| { | ||
| "type": "varchar(2048)", | ||
| "typeSchema": null, | ||
| "notNull": false, | ||
| "dimensions": 0, | ||
| "default": null, | ||
| "generated": null, | ||
| "identity": null, | ||
| "name": "title", | ||
| "schema": "public", | ||
| "table": "url_metadata", | ||
| "entityType": "columns" | ||
| }, | ||
| { | ||
| "type": "varchar(2048)", | ||
| "typeSchema": null, | ||
| "notNull": false, | ||
| "dimensions": 0, | ||
| "default": null, | ||
| "generated": null, | ||
| "identity": null, | ||
| "name": "icon_key", | ||
| "schema": "public", | ||
| "table": "url_metadata", | ||
| "entityType": "columns" | ||
| }, | ||
| { | ||
| "type": "integer", | ||
| "typeSchema": null, | ||
| "notNull": false, | ||
| "dimensions": 0, | ||
| "default": null, | ||
| "generated": null, | ||
| "identity": null, | ||
| "name": "icon_width", | ||
| "schema": "public", | ||
| "table": "url_metadata", | ||
| "entityType": "columns" | ||
| }, | ||
| { | ||
| "type": "integer", | ||
| "typeSchema": null, | ||
| "notNull": false, | ||
| "dimensions": 0, | ||
| "default": null, | ||
| "generated": null, | ||
| "identity": null, | ||
| "name": "icon_height", | ||
| "schema": "public", | ||
| "table": "url_metadata", | ||
| "entityType": "columns" | ||
| }, | ||
| { | ||
| "type": "varchar(2048)", | ||
| "typeSchema": null, | ||
| "notNull": false, | ||
| "dimensions": 0, | ||
| "default": null, | ||
| "generated": null, | ||
| "identity": null, | ||
| "name": "banner_key", | ||
| "schema": "public", | ||
| "table": "url_metadata", | ||
| "entityType": "columns" | ||
| }, | ||
| { | ||
| "type": "integer", | ||
| "typeSchema": null, | ||
| "notNull": false, | ||
| "dimensions": 0, | ||
| "default": null, | ||
| "generated": null, | ||
| "identity": null, | ||
| "name": "banner_width", | ||
| "schema": "public", | ||
| "table": "url_metadata", | ||
| "entityType": "columns" | ||
| }, | ||
| { | ||
| "type": "integer", | ||
| "typeSchema": null, | ||
| "notNull": false, | ||
| "dimensions": 0, | ||
| "default": null, | ||
| "generated": null, | ||
| "identity": null, | ||
| "name": "banner_height", | ||
| "schema": "public", | ||
| "table": "url_metadata", | ||
| "entityType": "columns" | ||
| }, | ||
| { | ||
| "type": "timestamp with time zone", | ||
| "typeSchema": null, | ||
| "notNull": true, | ||
| "dimensions": 0, | ||
| "default": null, | ||
| "generated": null, | ||
| "identity": null, | ||
| "name": "fetched_at", | ||
| "schema": "public", | ||
| "table": "url_metadata", | ||
| "entityType": "columns" | ||
| }, | ||
| { | ||
| "type": "boolean", | ||
| "typeSchema": null, | ||
| "notNull": true, | ||
| "dimensions": 0, | ||
| "default": null, | ||
| "generated": null, | ||
| "identity": null, | ||
| "name": "error", | ||
| "schema": "public", | ||
| "table": "url_metadata", | ||
| "entityType": "columns" | ||
| } | ||
| ], | ||
| "renames": [] | ||
| } |
5 changes: 5 additions & 0 deletions
5
packages/db/drizzle/20250719232913_broad_archangel/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| ALTER TABLE "post_images" ALTER COLUMN "banner_key" DROP NOT NULL;--> statement-breakpoint | ||
| ALTER TABLE "post_images" ALTER COLUMN "link_preview_key" DROP NOT NULL;--> statement-breakpoint | ||
| ALTER TABLE "post_images" ADD COLUMN IF NOT EXISTS "index_md5" varchar(2048);--> statement-breakpoint | ||
| ALTER TABLE "post_images" ADD COLUMN IF NOT EXISTS "fetched_at" timestamp with time zone NOT NULL;--> statement-breakpoint | ||
| ALTER TABLE "post_images" ADD COLUMN IF NOT EXISTS "error" boolean NOT NULL; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding
NOT NULLcolumns without aDEFAULTwill fail on non-empty tables.If
post_imagesalready contains rows, PostgreSQL will reject theseALTER TABLE … ADD COLUMNstatements because it cannot assign a value to existing rows for aNOT NULLcolumn that has no default. TheIF NOT EXISTSguard only prevents adding a duplicate column — it does not help here.A typical fix is to either:
NOT NULL, orDEFAULT(e.g.,DEFAULT now()forfetched_at,DEFAULT falseforerror).🐛 Proposed fix — add defaults
If these defaults should not persist on future inserts, you can drop them after the migration:
📝 Committable suggestion
🤖 Prompt for AI Agents