From 4c2851cee5c7c266c29f97b5bd9e260f8e6a5744 Mon Sep 17 00:00:00 2001 From: Joseph Nelson Date: Wed, 13 May 2026 22:44:40 -0700 Subject: [PATCH] fixed migration issues --- ...02_create-image-table.js => 001_create-image-table.js} | 4 +++- ...collection-table.js => 002_create-collection-table.js} | 6 +++++- migrations/003_create-item-table.js | 4 +++- migrations/004_create-location-table.js | 2 ++ migrations/005_create-set-table.js | 8 +++++--- migrations/006_create-user-table.js | 4 ++-- migrations/007_create-role-table.js | 4 +++- 7 files changed, 23 insertions(+), 9 deletions(-) rename migrations/{002_create-image-table.js => 001_create-image-table.js} (65%) rename migrations/{001_create-collection-table.js => 002_create-collection-table.js} (52%) diff --git a/migrations/002_create-image-table.js b/migrations/001_create-image-table.js similarity index 65% rename from migrations/002_create-image-table.js rename to migrations/001_create-image-table.js index 012dba8..1841160 100644 --- a/migrations/002_create-image-table.js +++ b/migrations/001_create-image-table.js @@ -3,7 +3,9 @@ export const up = (pgm) => { CREATE TABLE image ( id UUID PRIMARY KEY, file TEXT, - image BYTEA + image BYTEA, + created_at TIMESTAMP DEFAULT NOW(), + updated_at TIMESTAMP DEFAULT NOW(), ); `) } diff --git a/migrations/001_create-collection-table.js b/migrations/002_create-collection-table.js similarity index 52% rename from migrations/001_create-collection-table.js rename to migrations/002_create-collection-table.js index 9e001e2..2ba94e2 100644 --- a/migrations/001_create-collection-table.js +++ b/migrations/002_create-collection-table.js @@ -2,7 +2,11 @@ export const up = (pgm) => { pgm.sql(` CREATE TABLE collection ( id UUID PRIMARY KEY, - name TEXT + name TEXT, + image_id UUID, + created_at TIMESTAMP DEFAULT NOW(), + updated_at TIMESTAMP DEFAULT NOW(), + FOREIGN KEY (image_id) REFERENCES image(id) ); `) } diff --git a/migrations/003_create-item-table.js b/migrations/003_create-item-table.js index fc764f2..4434ab7 100644 --- a/migrations/003_create-item-table.js +++ b/migrations/003_create-item-table.js @@ -7,9 +7,11 @@ export const up = (pgm) => { productId TEXT, name TEXT, cleanName TEXT, - extCardText TEXTAREA, + extCardText TEXT, marketPrice TEXT, extRarity TEXT, + created_at TIMESTAMP DEFAULT NOW(), + updated_at TIMESTAMP DEFAULT NOW(), FOREIGN KEY (collection_id) REFERENCES collection(id), FOREIGN KEY (image_id) REFERENCES image(id) ); diff --git a/migrations/004_create-location-table.js b/migrations/004_create-location-table.js index f341d51..6a0c267 100644 --- a/migrations/004_create-location-table.js +++ b/migrations/004_create-location-table.js @@ -3,6 +3,8 @@ export const up = (pgm) => { CREATE TABLE location ( id UUID PRIMARY KEY, name TEXT UNIQUE NOT NULL + created_at TIMESTAMP DEFAULT NOW(), + updated_at TIMESTAMP DEFAULT NOW() ); `) } diff --git a/migrations/005_create-set-table.js b/migrations/005_create-set-table.js index 30a6b93..117df2b 100644 --- a/migrations/005_create-set-table.js +++ b/migrations/005_create-set-table.js @@ -5,10 +5,12 @@ export const up = (pgm) => { collection_id UUID NOT NULL, name TEXT NOT NULL, location_id UUID, - createdAt TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, - updatedAt TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, + image_id UUID, + created_at TIMESTAMP DEFAULT NOW(), + updated_at TIMESTAMP DEFAULT NOW(), FOREIGN KEY (collection_id) REFERENCES collection(id), - FOREIGN KEY (location_id) REFERENCES location(id) + FOREIGN KEY (location_id) REFERENCES location(id), + FOREIGN KEY (image_id) REFERENCES image(id) ); `) } diff --git a/migrations/006_create-user-table.js b/migrations/006_create-user-table.js index 8d0c1f6..49a69cc 100644 --- a/migrations/006_create-user-table.js +++ b/migrations/006_create-user-table.js @@ -6,8 +6,8 @@ export const up = (pgm) => { password TEXT NOT NULL, role_id UUID, email TEXT UNIQUE NOT NULL, - createdAt TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, - updatedAt TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, + created_at TIMESTAMP DEFAULT NOW(), + updated_at TIMESTAMP DEFAULT NOW(), FOREIGN KEY (role_id) REFERENCES role(id) ); `) diff --git a/migrations/007_create-role-table.js b/migrations/007_create-role-table.js index 1cf4128..e516aab 100644 --- a/migrations/007_create-role-table.js +++ b/migrations/007_create-role-table.js @@ -2,7 +2,9 @@ export const up = (pgm) => { pgm.sql(` CREATE TABLE role ( id UUID PRIMARY KEY, - name TEXT UNIQUE NOT NULL + name TEXT UNIQUE NOT NULL, + created_at TIMESTAMP DEFAULT NOW(), + updated_at TIMESTAMP DEFAULT NOW() ); `) }