export const shorthands = undefined; /** * @param pgm {import('node-pg-migrate').MigrationBuilder} * @param run {() => void | undefined} * @returns {Promise | void} */ export function up(pgm) { pgm.createType('protocol_type', ['http', 'https']); pgm.createTable('proxies', { id: 'id', proto: {type: 'protocol_type', notNull: true}, claimed: {type: 'boolean', default: false}, host: {type: 'inet', notNull: true}, port: {type: 'smallint', notNull: true}, username: {type: 'varchar(16)'}, password: {type: 'varchar(32)'} }); pgm.addColumn('captchas', {proxy_id: {type: 'integer', references: 'proxies(id)'}}); } /** * @param pgm {import('node-pg-migrate').MigrationBuilder} * @param run {() => void | undefined} * @returns {Promise | void} */ export function down(pgm) { pgm.dropType('protocol_type'); pgm.dropTable('proxies'); pgm.dropColumn('captchas', 'proxy_id'); }