working on healthcheck api and auth api (#2)
Reviewed-on: #2 Co-authored-by: Joseph Nelson <joseph.nelson4456@gmail.com> Co-committed-by: Joseph Nelson <joseph.nelson4456@gmail.com>
This commit was merged in pull request #2.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
export const up = (pgm) => {
|
||||
pgm.sql(`
|
||||
CREATE TABLE images (
|
||||
id UUID PRIMARY KEY,
|
||||
file TEXT,
|
||||
image BYTEA,
|
||||
created_at TIMESTAMP DEFAULT NOW(),
|
||||
updated_at TIMESTAMP DEFAULT NOW()
|
||||
);
|
||||
`)
|
||||
}
|
||||
|
||||
export const down = (pgm) => {
|
||||
pgm.sql(`
|
||||
DROP TABLE images;
|
||||
`)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
export const up = (pgm) => {
|
||||
pgm.sql(`
|
||||
CREATE TABLE collections (
|
||||
id UUID PRIMARY KEY,
|
||||
name TEXT,
|
||||
image_id UUID,
|
||||
created_at TIMESTAMP DEFAULT NOW(),
|
||||
updated_at TIMESTAMP DEFAULT NOW(),
|
||||
FOREIGN KEY (image_id) REFERENCES images(id)
|
||||
);
|
||||
`)
|
||||
}
|
||||
|
||||
export const down = (pgm) => {
|
||||
pgm.sql(`
|
||||
DROP TABLE collections;
|
||||
`)
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
export const up = (pgm) => {
|
||||
pgm.sql(`
|
||||
CREATE TABLE items (
|
||||
id UUID PRIMARY KEY,
|
||||
collection_id UUID,
|
||||
image_id UUID,
|
||||
productId TEXT,
|
||||
name TEXT,
|
||||
cleanName TEXT,
|
||||
extCardText TEXT,
|
||||
marketPrice TEXT,
|
||||
extRarity TEXT,
|
||||
created_at TIMESTAMP DEFAULT NOW(),
|
||||
updated_at TIMESTAMP DEFAULT NOW(),
|
||||
FOREIGN KEY (collection_id) REFERENCES collections(id),
|
||||
FOREIGN KEY (image_id) REFERENCES images(id)
|
||||
);
|
||||
`)
|
||||
}
|
||||
|
||||
export const down = (pgm) => {
|
||||
pgm.sql(`
|
||||
DROP TABLE items;
|
||||
`)
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
export const up = (pgm) => {
|
||||
pgm.sql(`
|
||||
CREATE TABLE locations (
|
||||
id UUID PRIMARY KEY,
|
||||
name TEXT UNIQUE NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT NOW(),
|
||||
updated_at TIMESTAMP DEFAULT NOW()
|
||||
);
|
||||
`)
|
||||
}
|
||||
|
||||
export const down = (pgm) => {
|
||||
pgm.sql(`
|
||||
DROP TABLE locations;
|
||||
`)
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
export const up = (pgm) => {
|
||||
pgm.sql(`
|
||||
CREATE TABLE sets (
|
||||
id UUID PRIMARY KEY,
|
||||
collection_id UUID NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
location_id UUID,
|
||||
image_id UUID,
|
||||
created_at TIMESTAMP DEFAULT NOW(),
|
||||
updated_at TIMESTAMP DEFAULT NOW(),
|
||||
FOREIGN KEY (collection_id) REFERENCES collections(id),
|
||||
FOREIGN KEY (location_id) REFERENCES locations(id),
|
||||
FOREIGN KEY (image_id) REFERENCES images(id)
|
||||
);
|
||||
`)
|
||||
}
|
||||
|
||||
export const down = (pgm) => {
|
||||
pgm.sql(`
|
||||
DROP TABLE sets;
|
||||
`)
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
export const up = (pgm) => {
|
||||
pgm.sql(`
|
||||
CREATE TABLE roles (
|
||||
id UUID PRIMARY KEY,
|
||||
name TEXT UNIQUE NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT NOW(),
|
||||
updated_at TIMESTAMP DEFAULT NOW()
|
||||
);
|
||||
`)
|
||||
}
|
||||
|
||||
export const down = (pmg) => {
|
||||
pgm.sql(`
|
||||
DROP TABLE roles;
|
||||
`)
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
export const up = (pgm) => {
|
||||
pgm.sql(`
|
||||
CREATE TABLE users (
|
||||
id UUID PRIMARY KEY,
|
||||
username TEXT UNIQUE NOT NULL,
|
||||
password TEXT NOT NULL,
|
||||
role_id UUID,
|
||||
email TEXT UNIQUE NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT NOW(),
|
||||
updated_at TIMESTAMP DEFAULT NOW(),
|
||||
FOREIGN KEY (role_id) REFERENCES roles(id)
|
||||
);
|
||||
`)
|
||||
}
|
||||
|
||||
export const down = (pgm) => {
|
||||
pgm.sql(`
|
||||
DROP TABLE users;
|
||||
`)
|
||||
}
|
||||
Reference in New Issue
Block a user