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 (
|
CREATE TABLE IF NOT EXISTS protection_subscriptions (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
company_id INT REFERENCES users(id) ON DELETE CASCADE,
|
company_id INT REFERENCES users(id) ON DELETE CASCADE,
|
||||||
plan_id INT REFERENCES protection_plans(id) ON DELETE RESTRICT,
|
plan_id INT REFERENCES protection_plans(id) ON DELETE RESTRICT,
|
||||||
client_name TEXT NOT NULL,
|
client_name TEXT NOT NULL,
|
||||||
client_dni TEXT,
|
client_dni TEXT,
|
||||||
client_phone TEXT,
|
client_phone TEXT,
|
||||||
payment_status TEXT DEFAULT 'pagado',
|
|
||||||
status TEXT DEFAULT 'activo',
|
payment_status TEXT DEFAULT 'impagado',
|
||||||
custom_discount INT DEFAULT 0,
|
status TEXT DEFAULT 'pendiente_pago',
|
||||||
bricos_used INT DEFAULT 0,
|
|
||||||
urgencies_used INT DEFAULT 0,
|
custom_discount INT DEFAULT 0,
|
||||||
renewal_date DATE,
|
bricos_used INT DEFAULT 0,
|
||||||
contract_pdf_url TEXT,
|
urgencies_used INT DEFAULT 0,
|
||||||
created_at TIMESTAMP DEFAULT NOW()
|
|
||||||
);
|
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 (
|
CREATE TABLE IF NOT EXISTS protection_activity (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
|
|||||||
Reference in New Issue
Block a user