From 22fae7dc18b70134629be969e2bc8b739816b9e9 Mon Sep 17 00:00:00 2001 From: Shivam Sharma Date: Wed, 18 Sep 2024 17:18:40 +0530 Subject: [PATCH] feat(db): extend applications table with review tag (#156) --- app/composables/applications.ts | 2 + server/db/migrations/0010_amused_hairball.sql | 2 + server/db/migrations/meta/0010_snapshot.json | 385 ++++++++++++++++++ server/db/migrations/meta/_journal.json | 7 + server/db/schema.ts | 2 + 5 files changed, 398 insertions(+) create mode 100644 server/db/migrations/0010_amused_hairball.sql create mode 100644 server/db/migrations/meta/0010_snapshot.json diff --git a/app/composables/applications.ts b/app/composables/applications.ts index ed63b77b..6d107a50 100644 --- a/app/composables/applications.ts +++ b/app/composables/applications.ts @@ -7,6 +7,8 @@ export type Application = { id: string; candidateId: string; postingId: string; + status: number; + statusType: number; }; export type Applications = Record; // postingId <> applications diff --git a/server/db/migrations/0010_amused_hairball.sql b/server/db/migrations/0010_amused_hairball.sql new file mode 100644 index 00000000..583447c4 --- /dev/null +++ b/server/db/migrations/0010_amused_hairball.sql @@ -0,0 +1,2 @@ +ALTER TABLE "posting_applicants" ADD COLUMN "status_id" integer DEFAULT -1;--> statement-breakpoint +ALTER TABLE "posting_applicants" ADD COLUMN "status_type" smallint DEFAULT 0; \ No newline at end of file diff --git a/server/db/migrations/meta/0010_snapshot.json b/server/db/migrations/meta/0010_snapshot.json new file mode 100644 index 00000000..791a17a8 --- /dev/null +++ b/server/db/migrations/meta/0010_snapshot.json @@ -0,0 +1,385 @@ +{ + "id": "da7c8cd2-dd89-4312-9ba2-1d15bd5e13c0", + "prevId": "1c9c0011-c57e-4840-ab36-a39bb4ba0e5c", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.hooks": { + "name": "hooks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(40)", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "prefs": { + "name": "prefs", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "last_executed_at": { + "name": "last_executed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.job_postings": { + "name": "job_postings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(150)", + "primaryKey": false, + "notNull": true + }, + "contents": { + "name": "contents", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tags_csv": { + "name": "tags_csv", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "owner_id": { + "name": "owner_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "is_published": { + "name": "is_published", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "total_applicants": { + "name": "total_applicants", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "job_postings_owner_id_users_id_fk": { + "name": "job_postings_owner_id_users_id_fk", + "tableFrom": "job_postings", + "tableTo": "users", + "columnsFrom": ["owner_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.metadata_entries": { + "name": "metadata_entries", + "schema": "", + "columns": { + "key": { + "name": "key", + "type": "varchar(48)", + "primaryKey": true, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.posting_applicants": { + "name": "posting_applicants", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "owner_id": { + "name": "owner_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "job_id": { + "name": "job_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "status_id": { + "name": "status_id", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": -1 + }, + "status_type": { + "name": "status_type", + "type": "smallint", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "posting_applicants_owner_id_users_id_fk": { + "name": "posting_applicants_owner_id_users_id_fk", + "tableFrom": "posting_applicants", + "tableTo": "users", + "columnsFrom": ["owner_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "posting_applicants_job_id_job_postings_id_fk": { + "name": "posting_applicants_job_id_job_postings_id_fk", + "tableFrom": "posting_applicants", + "tableTo": "job_postings", + "columnsFrom": ["job_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.review_tags": { + "name": "review_tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true + }, + "parent": { + "name": "parent", + "type": "smallint", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user_handles": { + "name": "user_handles", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "key": { + "name": "key", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_handles_user_id_users_id_fk": { + "name": "user_handles_user_id_users_id_fk", + "tableFrom": "user_handles", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "first_name": { + "name": "first_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "last_name": { + "name": "last_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "picture": { + "name": "picture", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "top_5_skills_csv": { + "name": "top_5_skills_csv", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_admin": { + "name": "is_admin", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": ["email"] + } + } + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/server/db/migrations/meta/_journal.json b/server/db/migrations/meta/_journal.json index f5b14d7f..ebdfab4d 100644 --- a/server/db/migrations/meta/_journal.json +++ b/server/db/migrations/meta/_journal.json @@ -71,6 +71,13 @@ "when": 1726223608639, "tag": "0009_luxuriant_purifiers", "breakpoints": true + }, + { + "idx": 10, + "version": "7", + "when": 1726641900159, + "tag": "0010_amused_hairball", + "breakpoints": true } ] } diff --git a/server/db/schema.ts b/server/db/schema.ts index 9b29df0e..a3fa61d8 100644 --- a/server/db/schema.ts +++ b/server/db/schema.ts @@ -68,6 +68,8 @@ export const postingApplicantsTable = pgTable('posting_applicants', { onDelete: 'cascade', }) .notNull(), + status: integer('status_id').default(-1), + statusType: smallint('status_type').default(0), createdAt: timestamp('created_at').defaultNow().notNull(), });