Files
tcg-collectors-server/migrations/005_create-set-table.js
T
joseph.nelson4456 0601c41f46
Build and Push Image / build-and-push (push) Successful in 1m43s
updated migrations
2026-05-12 22:28:51 -07:00

35 lines
828 B
JavaScript

export default {
up: async (pool) => {
try {
await pool.query(
`
CREATE TABLE set (
id UUID PRIMARY KEY,
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,
FOREIGN KEY (collection_id) REFERENCES collection(id),
FOREIGN KEY (location_id) REFERENCES location(id)
);
`
)
} catch (error) {
console.error('Error creating set table:', error)
throw error
}
},
down: async (pool) => {
try {
await pool.query(`
DROP TABLE set;
`)
} catch (error) {
console.error('Error dropping set table:', error)
throw error
}
},
}