const { TABLE_OPTIONS, column: c, index: i, uniqueIndex: u, foreignKey: fk } = require('./helpers'); const vipTables = [ { name: 'vip_derivation_counters', group: 'vip', wrapped: false, columns: [c('coin',"ENUM('btc', 'ltc') NOT NULL",'enum',false),c('next_index','INT NOT NULL DEFAULT 0','int',false,'0'),c('created_at','TIMESTAMP DEFAULT CURRENT_TIMESTAMP','timestamp',true,'CURRENT_TIMESTAMP'),c('updated_at','TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP','timestamp',true,'CURRENT_TIMESTAMP','on update CURRENT_TIMESTAMP')], primaryKey: ['coin'], indexes: [], foreignKeys: [], options: TABLE_OPTIONS }, { name: 'vip_invoices', group: 'vip', wrapped: false, columns: [ c('id','INT NOT NULL AUTO_INCREMENT','int',false,null,'auto_increment'),c('public_id','VARCHAR(64) NOT NULL','varchar(64)',false),c('payment_method',"ENUM('btc', 'ltc', 'paygate_hosted', 'autobuy', 'payblis') NOT NULL",'enum',false),c('status',"ENUM('awaiting_payment', 'partial_payment', 'confirming', 'paid', 'delivered', 'expired', 'cancelled') NOT NULL DEFAULT 'awaiting_payment'",'enum',false,'awaiting_payment'),c('coin',"ENUM('btc', 'ltc') DEFAULT NULL",'enum',true),c('pack_eur','DECIMAL(10,2) NOT NULL','decimal(10,2)',false),c('amount_eur','DECIMAL(10,2) NOT NULL','decimal(10,2)',false),c('amount_usd','DECIMAL(10,2) NOT NULL','decimal(10,2)',false),c('amount_crypto_expected','DECIMAL(20,8) DEFAULT NULL','decimal(20,8)',true),c('amount_crypto_received','DECIMAL(20,8) NOT NULL DEFAULT 0','decimal(20,8)',false,'0'),c('vip_years','DECIMAL(5,2) NOT NULL','decimal(5,2)',false),c('recipient_mode',"ENUM('self', 'gift') NOT NULL",'enum',false),c('payment_address','VARCHAR(128) DEFAULT NULL','varchar(128)',true),c('address_type','VARCHAR(32) DEFAULT NULL','varchar(32)',true),c('derivation_index','INT DEFAULT NULL','int',true),c('confirmations','INT NOT NULL DEFAULT 0','int',false,'0'),c('required_confirmations','INT NOT NULL DEFAULT 1','int',false,'1'),c('tx_hash','VARCHAR(128) DEFAULT NULL','varchar(128)',true),c('qr_payload','TEXT DEFAULT NULL','text',true),c('gift_token','VARCHAR(64) DEFAULT NULL','varchar(64)',true),c('gift_sealed','TINYINT(1) NOT NULL DEFAULT 1','tinyint(1)',false,'1'),c('gift_unsealed_at','DATETIME DEFAULT NULL','datetime',true),c('gift_unseal_count','INT NOT NULL DEFAULT 0','int',false,'0'),c('gift_unsealed_by_ip_hash','VARCHAR(128) DEFAULT NULL','varchar(128)',true),c('vip_key_value','VARCHAR(255) DEFAULT NULL','varchar(255)',true),c('created_by_user_id','VARCHAR(255) DEFAULT NULL','varchar(255)',true),c('created_by_user_type','VARCHAR(32) DEFAULT NULL','varchar(32)',true),c('created_by_session_id','VARCHAR(255) DEFAULT NULL','varchar(255)',true),c('created_ip_hash','VARCHAR(128) DEFAULT NULL','varchar(128)',true),c('expires_at','DATETIME NOT NULL','datetime',false),c('paid_at','DATETIME DEFAULT NULL','datetime',true),c('delivered_at','DATETIME DEFAULT NULL','datetime',true),c('next_check_at','DATETIME DEFAULT NULL','datetime',true), c('paygate_callback_reference','VARCHAR(64) DEFAULT NULL','varchar(64)',true),c('paygate_tracking_address','VARCHAR(255) DEFAULT NULL','varchar(255)',true),c('paygate_temporary_wallet_address','VARCHAR(255) DEFAULT NULL','varchar(255)',true),c('paygate_callback_url','TEXT DEFAULT NULL','text',true),c('paygate_callback_nonce','VARCHAR(128) DEFAULT NULL','varchar(128)',true),c('paygate_checkout_url','TEXT DEFAULT NULL','text',true),c('paygate_payer_email','VARCHAR(255) DEFAULT NULL','varchar(255)',true),c('paygate_ipn_token','VARCHAR(512) DEFAULT NULL','varchar(512)',true),c('paygate_paid_coin','VARCHAR(64) DEFAULT NULL','varchar(64)',true),c('paygate_paid_value','DECIMAL(18,8) DEFAULT NULL','decimal(18,8)',true),c('paygate_paid_txid_in','VARCHAR(255) DEFAULT NULL','varchar(255)',true),c('paygate_paid_txid','VARCHAR(255) DEFAULT NULL','varchar(255)',true),c('autobuy_order_id','VARCHAR(128) DEFAULT NULL','varchar(128)',true),c('autobuy_product_id','VARCHAR(128) DEFAULT NULL','varchar(128)',true),c('autobuy_email','VARCHAR(255) DEFAULT NULL','varchar(255)',true),c('autobuy_checkout_url','TEXT DEFAULT NULL','text',true),c('autobuy_gateway','VARCHAR(64) DEFAULT NULL','varchar(64)',true),c('autobuy_currency','VARCHAR(16) DEFAULT NULL','varchar(16)',true),c('autobuy_total','DECIMAL(18,8) DEFAULT NULL','decimal(18,8)',true),c('autobuy_order_created_at','DATETIME DEFAULT NULL','datetime',true), c('payblis_ref_order','VARCHAR(128) DEFAULT NULL','varchar(128)',true),c('payblis_checkout_url','TEXT DEFAULT NULL','text',true),c('payblis_payer_email','VARCHAR(255) DEFAULT NULL','varchar(255)',true),c('payblis_customer_name','VARCHAR(255) DEFAULT NULL','varchar(255)',true),c('payblis_method','VARCHAR(64) DEFAULT NULL','varchar(64)',true),c('payblis_transaction_id','VARCHAR(255) DEFAULT NULL','varchar(255)',true),c('payblis_paid_amount','DECIMAL(18,2) DEFAULT NULL','decimal(18,2)',true),c('payblis_paid_currency','VARCHAR(16) DEFAULT NULL','varchar(16)',true),c('payblis_ipn_received_at','DATETIME DEFAULT NULL','datetime',true),c('payblis_ipn_raw_payload','LONGTEXT DEFAULT NULL','longtext',true),c('created_at','TIMESTAMP DEFAULT CURRENT_TIMESTAMP','timestamp',true,'CURRENT_TIMESTAMP'),c('updated_at','TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP','timestamp',true,'CURRENT_TIMESTAMP','on update CURRENT_TIMESTAMP') ], primaryKey: ['id'], indexes: [u('uq_vip_invoices_public_id',['public_id']),u('uq_vip_invoices_gift_token',['gift_token']),i('idx_vip_invoices_payment_method',['payment_method']),i('idx_vip_invoices_status',['status']),i('idx_vip_invoices_coin',['coin']),i('idx_vip_invoices_created_at',['created_at']),i('idx_vip_invoices_payment_address',['payment_address']),i('idx_vip_invoices_vip_key',['vip_key_value']),i('idx_vip_invoices_paygate_paid_txid',['paygate_paid_txid']),u('uniq_vip_invoices_paygate_callback_reference',['paygate_callback_reference']),u('uniq_vip_invoices_paygate_paid_txid_in',['paygate_paid_txid_in']),u('uniq_vip_invoices_autobuy_order_id',['autobuy_order_id']),u('uniq_vip_invoices_payblis_ref_order',['payblis_ref_order']),i('idx_vip_invoices_payblis_tx',['payblis_transaction_id'])], foreignKeys: [], options: TABLE_OPTIONS }, { name: 'vip_invoice_events', group: 'vip', wrapped: false, columns: [c('id','INT NOT NULL AUTO_INCREMENT','int',false,null,'auto_increment'),c('invoice_id','INT NOT NULL','int',false),c('event_type','VARCHAR(64) NOT NULL','varchar(64)',false),c('actor_type','VARCHAR(32) DEFAULT NULL','varchar(32)',true),c('actor_id','VARCHAR(255) DEFAULT NULL','varchar(255)',true),c('message','VARCHAR(255) DEFAULT NULL','varchar(255)',true),c('payload_json','LONGTEXT DEFAULT NULL','longtext',true),c('created_at','TIMESTAMP DEFAULT CURRENT_TIMESTAMP','timestamp',true,'CURRENT_TIMESTAMP')], primaryKey: ['id'], indexes: [i('idx_vip_invoice_events_invoice',['invoice_id']),i('idx_vip_invoice_events_type',['event_type'])], foreignKeys: [fk('fk_vip_invoice_events_invoice',['invoice_id'],'vip_invoices',['id'],'CASCADE')], options: TABLE_OPTIONS }, ]; module.exports = { vipTables };