package-tours) adding support for pre-defining tours
This commit is contained in:
@@ -255,6 +255,7 @@ export function runMigrations(db: Database): void {
|
||||
id TEXT PRIMARY KEY,
|
||||
plan_id TEXT NOT NULL REFERENCES plans(id) ON DELETE CASCADE,
|
||||
operator_name TEXT NOT NULL,
|
||||
tour_name TEXT,
|
||||
confirmation_number TEXT,
|
||||
start_date TEXT,
|
||||
start_time TEXT,
|
||||
@@ -268,6 +269,12 @@ export function runMigrations(db: Database): void {
|
||||
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
||||
)
|
||||
`);
|
||||
// Migration: add tour_name to existing databases
|
||||
try {
|
||||
db.run(`ALTER TABLE package_tours ADD COLUMN tour_name TEXT`);
|
||||
} catch {
|
||||
/* already exists */
|
||||
}
|
||||
|
||||
// Package tour travellers - links people to package tours
|
||||
db.run(`
|
||||
@@ -290,6 +297,31 @@ export function runMigrations(db: Database): void {
|
||||
)
|
||||
`);
|
||||
|
||||
// Predefined tours per tour operator (admin-managed)
|
||||
db.run(`
|
||||
CREATE TABLE IF NOT EXISTS operator_tours (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
operator_id INTEGER NOT NULL REFERENCES tour_operators(id) ON DELETE CASCADE,
|
||||
name TEXT NOT NULL,
|
||||
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
||||
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
||||
)
|
||||
`);
|
||||
|
||||
// Template itinerary days for predefined operator tours
|
||||
db.run(`
|
||||
CREATE TABLE IF NOT EXISTS operator_tour_days (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
operator_tour_id INTEGER NOT NULL REFERENCES operator_tours(id) ON DELETE CASCADE,
|
||||
day_number INTEGER NOT NULL DEFAULT 1,
|
||||
title TEXT,
|
||||
notes TEXT,
|
||||
position INTEGER NOT NULL DEFAULT 0,
|
||||
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
||||
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
||||
)
|
||||
`);
|
||||
|
||||
// Countries table — editable list for admin (used by country selector)
|
||||
db.run(`
|
||||
CREATE TABLE IF NOT EXISTS countries (
|
||||
|
||||
Reference in New Issue
Block a user