Working base server with migrations and build steps ironed out #1
@@ -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(),
|
||||
);
|
||||
`)
|
||||
}
|
||||
+5
-1
@@ -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)
|
||||
);
|
||||
`)
|
||||
}
|
||||
@@ -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)
|
||||
);
|
||||
|
||||
@@ -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()
|
||||
);
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
`)
|
||||
|
||||
@@ -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()
|
||||
);
|
||||
`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user