working on first setup of pg migrations

This commit is contained in:
2026-05-10 19:51:13 -07:00
parent 3cdec698ef
commit 5318a1eb4a
5 changed files with 121 additions and 1 deletions
+36
View File
@@ -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
}
},
}