open-music-api-node
Version:
42 lines (38 loc) • 809 B
JavaScript
/* eslint-disable camelcase */
exports.shorthands = undefined;
exports.up = (pgm) => {
pgm.createTable('playlist_activity', {
id: {
type: 'SERIAL',
primaryKey: true,
},
title: {
type: 'TEXT',
notNull: true,
},
action: {
type: 'TEXT',
notNull: true,
},
username: {
type: 'TEXT',
notNull: true,
},
playlist_id: {
type: 'VARCHAR(50)',
notNull: true,
},
created_at: {
type: 'TIMESTAMP',
notNull: true,
},
updated_at: {
type: 'TIMESTAMP',
notNull: true,
},
});
pgm.addConstraint('playlist_activity', 'fk_activity_playlist', 'FOREIGN KEY(playlist_id) REFERENCES playlist(id) ON DELETE CASCADE');
};
exports.down = (pgm) => {
pgm.dropTable('playlist_activity');
};