Actualizar server.js
This commit is contained in:
48
server.js
48
server.js
@@ -325,21 +325,39 @@ async function autoUpdateDB() {
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS protection_subscriptions (
|
||||
id SERIAL PRIMARY KEY,
|
||||
company_id INT REFERENCES users(id) ON DELETE CASCADE,
|
||||
plan_id INT REFERENCES protection_plans(id) ON DELETE RESTRICT,
|
||||
client_name TEXT NOT NULL,
|
||||
client_dni TEXT,
|
||||
client_phone TEXT,
|
||||
payment_status TEXT DEFAULT 'pagado',
|
||||
status TEXT DEFAULT 'activo',
|
||||
custom_discount INT DEFAULT 0,
|
||||
bricos_used INT DEFAULT 0,
|
||||
urgencies_used INT DEFAULT 0,
|
||||
renewal_date DATE,
|
||||
contract_pdf_url TEXT,
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
);
|
||||
id SERIAL PRIMARY KEY,
|
||||
company_id INT REFERENCES users(id) ON DELETE CASCADE,
|
||||
plan_id INT REFERENCES protection_plans(id) ON DELETE RESTRICT,
|
||||
client_name TEXT NOT NULL,
|
||||
client_dni TEXT,
|
||||
client_phone TEXT,
|
||||
|
||||
payment_status TEXT DEFAULT 'impagado',
|
||||
status TEXT DEFAULT 'pendiente_pago',
|
||||
|
||||
custom_discount INT DEFAULT 0,
|
||||
bricos_used INT DEFAULT 0,
|
||||
urgencies_used INT DEFAULT 0,
|
||||
|
||||
renewal_date DATE,
|
||||
contract_pdf_url TEXT,
|
||||
|
||||
stripe_session_id TEXT,
|
||||
stripe_subscription_id TEXT,
|
||||
stripe_customer_id TEXT,
|
||||
stripe_price_id TEXT,
|
||||
|
||||
started_at TIMESTAMP,
|
||||
current_period_start TIMESTAMP,
|
||||
current_period_end TIMESTAMP,
|
||||
last_payment_at TIMESTAMP,
|
||||
cancel_at_period_end BOOLEAN DEFAULT FALSE,
|
||||
cancelled_at TIMESTAMP,
|
||||
ended_at TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT NOW(),
|
||||
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS protection_activity (
|
||||
id SERIAL PRIMARY KEY,
|
||||
|
||||
Reference in New Issue
Block a user