working on first setup of pg migrations
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
export default {
|
||||
up: async (pool) => {
|
||||
try {
|
||||
await pool.query(
|
||||
`
|
||||
CREATE TABLE item (
|
||||
id UUID PRIMARY KEY,
|
||||
collection_id UUID,
|
||||
image_id UUID,
|
||||
productId TEXT,
|
||||
name TEXT,
|
||||
cleanName TEXT,
|
||||
extCardText TEXTAREA,
|
||||
marketPrice TEXT,
|
||||
extRarity TEXT,
|
||||
FOREIGN KEY (collection_id) REFERENCES collection(id),
|
||||
FOREIGN KEY (image_id) REFERENCES image(id)
|
||||
);
|
||||
`
|
||||
)
|
||||
} catch (error) {
|
||||
console.error('Error creating item table:', error)
|
||||
throw error // Re-throw to signal failure to the migration runner
|
||||
}
|
||||
},
|
||||
down: async (pool) => {
|
||||
try {
|
||||
await pool.query(`
|
||||
DROP TABLE item;
|
||||
`)
|
||||
} catch (error) {
|
||||
console.error('Error dropping item table:', error)
|
||||
throw error
|
||||
}
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user