Files
tcg-collectors-server/migrations/003_create-item-table.js
T

37 lines
858 B
JavaScript

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
}
},
}