Files
tcg-collectors-server/migrations/006_create-user-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

34 lines
798 B
JavaScript

export default {
up: async (pool) => {
try {
await pool.query(
`
CREATE TABLE user (
id UUID PRIMARY KEY,
username TEXT UNIQUE NOT NULL,
password TEXT NOT NULL,
role_id UUID,
email TEXT UNIQUE NOT NULL,
createdAt TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updatedAt TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (role_id) REFERENCES role(id)
);
`
)
} catch (error) {
console.error('Error creating user table:', error)
throw error
}
},
down: async (pool) => {
try {
await pool.query(`
DROP TABLE user;
`)
} catch (error) {
console.error('Error dropping user table:', error)
throw error
}
},
}