This repository has been archived by the owner on Sep 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56f2e9f
commit 59b07e3
Showing
10 changed files
with
625 additions
and
84 deletions.
There are no files selected for viewing
This file contains 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 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,17 @@ | ||
CREATE TABLE IF NOT EXISTS "user_upvote_link" ( | ||
"user_id" uuid NOT NULL, | ||
"link_id" uuid NOT NULL, | ||
"created_at" timestamp with time zone NOT NULL | ||
); | ||
--> statement-breakpoint | ||
DO $$ BEGIN | ||
ALTER TABLE "user_upvote_link" ADD CONSTRAINT "user_upvote_link_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action; | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; | ||
--> statement-breakpoint | ||
DO $$ BEGIN | ||
ALTER TABLE "user_upvote_link" ADD CONSTRAINT "user_upvote_link_link_id_links_id_fk" FOREIGN KEY ("link_id") REFERENCES "public"."links"("id") ON DELETE no action ON UPDATE no action; | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; |
This file contains 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,3 @@ | ||
ALTER TABLE "links" ALTER COLUMN "views" SET DEFAULT 0;--> statement-breakpoint | ||
ALTER TABLE "links" ALTER COLUMN "votes" SET DEFAULT 0;--> statement-breakpoint | ||
ALTER TABLE "links" ADD COLUMN "user_name" text DEFAULT '' NOT NULL; |
This file contains 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,219 @@ | ||
{ | ||
"id": "f5b8df06-1ea7-4ac5-b2c8-5decd3b885b0", | ||
"prevId": "2f5e53ae-4268-495e-b5bf-3fb2cfc09163", | ||
"version": "6", | ||
"dialect": "postgresql", | ||
"tables": { | ||
"public.links": { | ||
"name": "links", | ||
"schema": "", | ||
"columns": { | ||
"id": { | ||
"name": "id", | ||
"type": "uuid", | ||
"primaryKey": true, | ||
"notNull": true | ||
}, | ||
"url": { | ||
"name": "url", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"title": { | ||
"name": "title", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"host": { | ||
"name": "host", | ||
"type": "varchar(325)", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"user_id": { | ||
"name": "user_id", | ||
"type": "uuid", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"views": { | ||
"name": "views", | ||
"type": "integer", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"default": 1 | ||
}, | ||
"votes": { | ||
"name": "votes", | ||
"type": "integer", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"default": 1 | ||
}, | ||
"created_at": { | ||
"name": "created_at", | ||
"type": "timestamp with time zone", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"updated_at": { | ||
"name": "updated_at", | ||
"type": "timestamp with time zone", | ||
"primaryKey": false, | ||
"notNull": true | ||
} | ||
}, | ||
"indexes": {}, | ||
"foreignKeys": { | ||
"links_user_id_users_id_fk": { | ||
"name": "links_user_id_users_id_fk", | ||
"tableFrom": "links", | ||
"tableTo": "users", | ||
"columnsFrom": [ | ||
"user_id" | ||
], | ||
"columnsTo": [ | ||
"id" | ||
], | ||
"onDelete": "no action", | ||
"onUpdate": "no action" | ||
} | ||
}, | ||
"compositePrimaryKeys": {}, | ||
"uniqueConstraints": {} | ||
}, | ||
"public.user_upvote_link": { | ||
"name": "user_upvote_link", | ||
"schema": "", | ||
"columns": { | ||
"user_id": { | ||
"name": "user_id", | ||
"type": "uuid", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"link_id": { | ||
"name": "link_id", | ||
"type": "uuid", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"created_at": { | ||
"name": "created_at", | ||
"type": "timestamp with time zone", | ||
"primaryKey": false, | ||
"notNull": true | ||
} | ||
}, | ||
"indexes": {}, | ||
"foreignKeys": { | ||
"user_upvote_link_user_id_users_id_fk": { | ||
"name": "user_upvote_link_user_id_users_id_fk", | ||
"tableFrom": "user_upvote_link", | ||
"tableTo": "users", | ||
"columnsFrom": [ | ||
"user_id" | ||
], | ||
"columnsTo": [ | ||
"id" | ||
], | ||
"onDelete": "no action", | ||
"onUpdate": "no action" | ||
}, | ||
"user_upvote_link_link_id_links_id_fk": { | ||
"name": "user_upvote_link_link_id_links_id_fk", | ||
"tableFrom": "user_upvote_link", | ||
"tableTo": "links", | ||
"columnsFrom": [ | ||
"link_id" | ||
], | ||
"columnsTo": [ | ||
"id" | ||
], | ||
"onDelete": "no action", | ||
"onUpdate": "no action" | ||
} | ||
}, | ||
"compositePrimaryKeys": {}, | ||
"uniqueConstraints": {} | ||
}, | ||
"public.users": { | ||
"name": "users", | ||
"schema": "", | ||
"columns": { | ||
"id": { | ||
"name": "id", | ||
"type": "uuid", | ||
"primaryKey": true, | ||
"notNull": true | ||
}, | ||
"frist_name": { | ||
"name": "frist_name", | ||
"type": "varchar(256)", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"last_name": { | ||
"name": "last_name", | ||
"type": "varchar(256)", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"email": { | ||
"name": "email", | ||
"type": "varchar(256)", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"image": { | ||
"name": "image", | ||
"type": "varchar(256)", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"created_at": { | ||
"name": "created_at", | ||
"type": "timestamp with time zone", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"updated_at": { | ||
"name": "updated_at", | ||
"type": "timestamp with time zone", | ||
"primaryKey": false, | ||
"notNull": true | ||
} | ||
}, | ||
"indexes": { | ||
"email_index": { | ||
"name": "email_index", | ||
"columns": [ | ||
"email" | ||
], | ||
"isUnique": true | ||
} | ||
}, | ||
"foreignKeys": {}, | ||
"compositePrimaryKeys": {}, | ||
"uniqueConstraints": {} | ||
} | ||
}, | ||
"enums": { | ||
"public.categories": { | ||
"name": "categories", | ||
"schema": "public", | ||
"values": [ | ||
"manufacturing", | ||
"research" | ||
] | ||
} | ||
}, | ||
"schemas": {}, | ||
"_meta": { | ||
"columns": {}, | ||
"schemas": {}, | ||
"tables": {} | ||
} | ||
} |
Oops, something went wrong.