diff --git a/migrations/001_create-image-table.js b/migrations/001_create-image-table.js index c39b6e8..aa5ba6c 100644 --- a/migrations/001_create-image-table.js +++ b/migrations/001_create-image-table.js @@ -1,6 +1,6 @@ export const up = (pgm) => { pgm.sql(` - CREATE TABLE image ( + CREATE TABLE images ( id UUID PRIMARY KEY, file TEXT, image BYTEA, @@ -12,6 +12,6 @@ export const up = (pgm) => { export const down = (pgm) => { pgm.sql(` - DROP TABLE image; + DROP TABLE images; `) } diff --git a/migrations/002_create-collection-table.js b/migrations/002_create-collection-table.js index 2ba94e2..fa29a28 100644 --- a/migrations/002_create-collection-table.js +++ b/migrations/002_create-collection-table.js @@ -1,18 +1,18 @@ export const up = (pgm) => { pgm.sql(` - CREATE TABLE collection ( + 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 image(id) + FOREIGN KEY (image_id) REFERENCES images(id) ); `) } export const down = (pgm) => { pgm.sql(` - DROP TABLE collection; + DROP TABLE collections; `) } diff --git a/migrations/003_create-item-table.js b/migrations/003_create-item-table.js index 4434ab7..75f88e1 100644 --- a/migrations/003_create-item-table.js +++ b/migrations/003_create-item-table.js @@ -1,6 +1,6 @@ export const up = (pgm) => { pgm.sql(` - CREATE TABLE item ( + CREATE TABLE items ( id UUID PRIMARY KEY, collection_id UUID, image_id UUID, @@ -12,14 +12,14 @@ export const up = (pgm) => { 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) + FOREIGN KEY (collection_id) REFERENCES collections(id), + FOREIGN KEY (image_id) REFERENCES images(id) ); `) } export const down = (pgm) => { pgm.sql(` - DROP TABLE item; + DROP TABLE items; `) } diff --git a/migrations/004_create-location-table.js b/migrations/004_create-location-table.js index 6074cbf..3298635 100644 --- a/migrations/004_create-location-table.js +++ b/migrations/004_create-location-table.js @@ -1,6 +1,6 @@ export const up = (pgm) => { pgm.sql(` - CREATE TABLE location ( + CREATE TABLE locations ( id UUID PRIMARY KEY, name TEXT UNIQUE NOT NULL, created_at TIMESTAMP DEFAULT NOW(), @@ -11,6 +11,6 @@ export const up = (pgm) => { export const down = (pgm) => { pgm.sql(` - DROP TABLE location; + DROP TABLE locations; `) } diff --git a/migrations/005_create-set-table.js b/migrations/005_create-set-table.js index 117df2b..3c220f5 100644 --- a/migrations/005_create-set-table.js +++ b/migrations/005_create-set-table.js @@ -1,6 +1,6 @@ export const up = (pgm) => { pgm.sql(` - CREATE TABLE set ( + CREATE TABLE sets ( id UUID PRIMARY KEY, collection_id UUID NOT NULL, name TEXT NOT NULL, @@ -8,15 +8,15 @@ export const up = (pgm) => { 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 (image_id) REFERENCES image(id) + 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 set; + DROP TABLE sets; `) } diff --git a/migrations/007_create-role-table.js b/migrations/006_create-role-table.js similarity index 83% rename from migrations/007_create-role-table.js rename to migrations/006_create-role-table.js index e516aab..52ef845 100644 --- a/migrations/007_create-role-table.js +++ b/migrations/006_create-role-table.js @@ -1,6 +1,6 @@ export const up = (pgm) => { pgm.sql(` - CREATE TABLE role ( + CREATE TABLE roles ( id UUID PRIMARY KEY, name TEXT UNIQUE NOT NULL, created_at TIMESTAMP DEFAULT NOW(), @@ -11,6 +11,6 @@ export const up = (pgm) => { export const down = (pmg) => { pgm.sql(` - DROP TABLE role; + DROP TABLE roles; `) } diff --git a/migrations/006_create-user-table.js b/migrations/007_create-user-table.js similarity index 77% rename from migrations/006_create-user-table.js rename to migrations/007_create-user-table.js index 49a69cc..1be04d5 100644 --- a/migrations/006_create-user-table.js +++ b/migrations/007_create-user-table.js @@ -1,6 +1,6 @@ export const up = (pgm) => { pgm.sql(` - CREATE TABLE user ( + CREATE TABLE users ( id UUID PRIMARY KEY, username TEXT UNIQUE NOT NULL, password TEXT NOT NULL, @@ -8,13 +8,13 @@ export const up = (pgm) => { email TEXT UNIQUE NOT NULL, created_at TIMESTAMP DEFAULT NOW(), updated_at TIMESTAMP DEFAULT NOW(), - FOREIGN KEY (role_id) REFERENCES role(id) + FOREIGN KEY (role_id) REFERENCES roles(id) ); `) } export const down = (pgm) => { pgm.sql(` - DROP TABLE user; + DROP TABLE users; `) }