diff --git a/config/config.example.yml b/config/config.example.yml index de094f03..d60ab2ba 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -1,9 +1,13 @@ app: dashboard_url: "http://localhost:3002" - base_domain: "localhost" log_level: "info" save_logs: false +domains: + domain1: + base_domain: "example.com" + cert_resolver: "letsencrypt" + server: external_port: 3000 internal_port: 3001 @@ -14,7 +18,6 @@ server: resource_session_request_param: "p_session_request" traefik: - cert_resolver: "letsencrypt" http_entrypoint: "web" https_entrypoint: "websecure" diff --git a/server/setup/scripts/1.0.0-beta15.ts b/server/setup/scripts/1.0.0-beta15.ts index cb116082..35f5b425 100644 --- a/server/setup/scripts/1.0.0-beta15.ts +++ b/server/setup/scripts/1.0.0-beta15.ts @@ -10,7 +10,25 @@ export default async function migration() { console.log(`Running setup script ${version}...`); try { - db.transaction((trx) => {}); + db.transaction((trx) => { + trx.run(sql`CREATE TABLE 'domains' ( + 'domainId' text PRIMARY KEY NOT NULL, + 'baseDomain' text NOT NULL, + 'configManaged' integer DEFAULT false NOT NULL +);`); + + trx.run(sql`CREATE TABLE 'orgDomains' ( + 'orgId' text NOT NULL, + 'domainId' text NOT NULL, + FOREIGN KEY ('orgId') REFERENCES 'orgs'('orgId') ON UPDATE no action ON DELETE cascade, + FOREIGN KEY ('domainId') REFERENCES 'domains'('domainId') ON UPDATE no action ON DELETE cascade +);`); + + trx.run( + sql`ALTER TABLE 'resources' ADD 'domainId' text REFERENCES domains(domainId);` + ); + trx.run(sql`ALTER TABLE 'orgs' DROP COLUMN 'domain';`); + }); console.log(`Migrated database schema`); } catch (e) {