Skip to content
Snippets Groups Projects
migration.js 655 B
module.exports = {
	up: (migration, Types) => {
		return migration.createTable('', {
			id: {
				type: Types.UUID,
				primaryKey: true,
				defaultValue: Types.UUIDV4,
				allowNull: false,
			},
			meta: {
				type: Types.JSONB,
				defaultValue: {},
				allowNull: false,
			},
			created_at: {
				type: Types.DATE,
				defaultValue: Types.fn('now'),
				allowNull: false,
			},
			updated_at: {
				type: Types.DATE,
				defaultValue: Types.fn('now'),
				allowNull: false,
			},
			deleted_at: {
				type: Types.DATE,
				defaultValue: null,
				allowNull: true,
			},
		})
	},

	down: (migration, Types) => {
		return migration.dropTable('')
	},
}