This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
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
|
||||
}
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user