unsuccessful(unstable and dirty) proxy solution
This commit is contained in:
23
migrations/1745667860234_captchas.js
Normal file
23
migrations/1745667860234_captchas.js
Normal file
@@ -0,0 +1,23 @@
|
||||
export const shorthands = undefined;
|
||||
|
||||
/**
|
||||
* @param pgm {import('node-pg-migrate').MigrationBuilder}
|
||||
* @param run {() => void | undefined}
|
||||
* @returns {Promise<void> | void}
|
||||
*/
|
||||
export function up(pgm) {
|
||||
pgm.createTable('captchas', {
|
||||
id: 'id',
|
||||
hash: {type: 'char(32)'},
|
||||
solution: {type: 'char(6)'}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pgm {import('node-pg-migrate').MigrationBuilder}
|
||||
* @param run {() => void | undefined}
|
||||
* @returns {Promise<void> | void}
|
||||
*/
|
||||
export function down(pgm) {
|
||||
pgm.dropTable('captchas')
|
||||
}
|
||||
33
migrations/1745668334604_proxies.js
Normal file
33
migrations/1745668334604_proxies.js
Normal file
@@ -0,0 +1,33 @@
|
||||
export const shorthands = undefined;
|
||||
|
||||
/**
|
||||
* @param pgm {import('node-pg-migrate').MigrationBuilder}
|
||||
* @param run {() => void | undefined}
|
||||
* @returns {Promise<void> | 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> | void}
|
||||
*/
|
||||
export function down(pgm) {
|
||||
pgm.dropType('protocol_type');
|
||||
pgm.dropTable('proxies');
|
||||
pgm.dropColumn('captchas', 'proxy_id');
|
||||
}
|
||||
Reference in New Issue
Block a user