unsuccessful(unstable and dirty) proxy solution

This commit is contained in:
2025-04-29 19:53:50 +03:00
parent c257844fa2
commit 991a4f29a6
12 changed files with 866 additions and 52 deletions

View 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')
}

View 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');
}