mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-12 18:37:20 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e271028f3 | ||
|
|
a724b07846 |
@@ -44,7 +44,6 @@ import m38 from "./scriptsSqlite/1.18.0";
|
|||||||
import m39 from "./scriptsSqlite/1.18.3";
|
import m39 from "./scriptsSqlite/1.18.3";
|
||||||
import m40 from "./scriptsSqlite/1.18.4";
|
import m40 from "./scriptsSqlite/1.18.4";
|
||||||
import m41 from "./scriptsSqlite/1.19.0";
|
import m41 from "./scriptsSqlite/1.19.0";
|
||||||
import m42 from "./scriptsSqlite/1.19.1";
|
|
||||||
|
|
||||||
// THIS CANNOT IMPORT ANYTHING FROM THE SERVER
|
// THIS CANNOT IMPORT ANYTHING FROM THE SERVER
|
||||||
// EXCEPT FOR THE DATABASE AND THE SCHEMA
|
// EXCEPT FOR THE DATABASE AND THE SCHEMA
|
||||||
@@ -86,8 +85,7 @@ const migrations = [
|
|||||||
{ version: "1.18.0", run: m38 },
|
{ version: "1.18.0", run: m38 },
|
||||||
{ version: "1.18.3", run: m39 },
|
{ version: "1.18.3", run: m39 },
|
||||||
{ version: "1.18.4", run: m40 },
|
{ version: "1.18.4", run: m40 },
|
||||||
{ version: "1.19.0", run: m41 },
|
{ version: "1.19.0", run: m41 }
|
||||||
{ version: "1.19.1", run: m42 }
|
|
||||||
// Add new migrations here as they are created
|
// Add new migrations here as they are created
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
|
|||||||
@@ -349,10 +349,10 @@ export default async function migration() {
|
|||||||
db.prepare(
|
db.prepare(
|
||||||
`
|
`
|
||||||
UPDATE 'targets'
|
UPDATE 'targets'
|
||||||
SET "mode" = COALESCE((
|
SET "mode" = (
|
||||||
SELECT "mode" FROM 'resources'
|
SELECT "mode" FROM 'resources'
|
||||||
WHERE "resources"."resourceId" = "targets"."resourceId"
|
WHERE "resources"."resourceId" = "targets"."resourceId"
|
||||||
), 'http');
|
);
|
||||||
`
|
`
|
||||||
).run();
|
).run();
|
||||||
db.prepare(
|
db.prepare(
|
||||||
@@ -680,16 +680,6 @@ export default async function migration() {
|
|||||||
deleteResourceRules.run(resource.resourceId);
|
deleteResourceRules.run(resource.resourceId);
|
||||||
deleteResourceWhitelist.run(resource.resourceId);
|
deleteResourceWhitelist.run(resource.resourceId);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
migrateInlinePolicies();
|
|
||||||
console.log(
|
|
||||||
`Migrated inline resource policies for ${existingResources.length} resource(s)`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// add one more transaction
|
|
||||||
db.transaction(() => {
|
|
||||||
// remove not null/default from sso, applyRules, and emailWhitelistEnabled in preparation for resource policies
|
// remove not null/default from sso, applyRules, and emailWhitelistEnabled in preparation for resource policies
|
||||||
db.prepare(`ALTER TABLE 'resources' DROP COLUMN 'sso';`).run();
|
db.prepare(`ALTER TABLE 'resources' DROP COLUMN 'sso';`).run();
|
||||||
db.prepare(
|
db.prepare(
|
||||||
@@ -709,7 +699,13 @@ export default async function migration() {
|
|||||||
db.prepare(
|
db.prepare(
|
||||||
`ALTER TABLE 'resources' ADD COLUMN 'emailWhitelistEnabled' integer;`
|
`ALTER TABLE 'resources' ADD COLUMN 'emailWhitelistEnabled' integer;`
|
||||||
).run();
|
).run();
|
||||||
})();
|
});
|
||||||
|
|
||||||
|
migrateInlinePolicies();
|
||||||
|
console.log(
|
||||||
|
`Migrated inline resource policies for ${existingResources.length} resource(s)`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
console.log("Migrated database");
|
console.log("Migrated database");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
import { APP_PATH, __DIRNAME } from "@server/lib/consts";
|
|
||||||
import Database from "better-sqlite3";
|
|
||||||
import path from "path";
|
|
||||||
|
|
||||||
const version = "1.19.1";
|
|
||||||
|
|
||||||
export default async function migration() {
|
|
||||||
console.log(`Running setup script ${version}...`);
|
|
||||||
|
|
||||||
const location = path.join(APP_PATH, "db", "db.sqlite");
|
|
||||||
const db = new Database(location);
|
|
||||||
|
|
||||||
try {
|
|
||||||
db.transaction(() => {
|
|
||||||
// remove not null/default from sso, applyRules, and emailWhitelistEnabled in preparation for resource policies
|
|
||||||
db.prepare(
|
|
||||||
`ALTER TABLE 'resources' ADD COLUMN 'sso2' integer;`
|
|
||||||
).run();
|
|
||||||
db.prepare(`UPDATE 'resources' SET "sso2" = "sso";`).run();
|
|
||||||
db.prepare(`ALTER TABLE 'resources' DROP COLUMN 'sso';`).run();
|
|
||||||
db.prepare(
|
|
||||||
`ALTER TABLE 'resources' RENAME COLUMN 'sso2' TO 'sso';`
|
|
||||||
).run();
|
|
||||||
|
|
||||||
db.prepare(
|
|
||||||
`ALTER TABLE 'resources' ADD COLUMN 'applyRules2' integer;`
|
|
||||||
).run();
|
|
||||||
db.prepare(
|
|
||||||
`UPDATE 'resources' SET "applyRules2" = "applyRules";`
|
|
||||||
).run();
|
|
||||||
db.prepare(
|
|
||||||
`ALTER TABLE 'resources' DROP COLUMN 'applyRules';`
|
|
||||||
).run();
|
|
||||||
db.prepare(
|
|
||||||
`ALTER TABLE 'resources' RENAME COLUMN 'applyRules2' TO 'applyRules';`
|
|
||||||
).run();
|
|
||||||
|
|
||||||
db.prepare(
|
|
||||||
`ALTER TABLE 'resources' ADD COLUMN 'emailWhitelistEnabled2' integer;`
|
|
||||||
).run();
|
|
||||||
db.prepare(
|
|
||||||
`UPDATE 'resources' SET "emailWhitelistEnabled2" = "emailWhitelistEnabled";`
|
|
||||||
).run();
|
|
||||||
db.prepare(
|
|
||||||
`ALTER TABLE 'resources' DROP COLUMN 'emailWhitelistEnabled';`
|
|
||||||
).run();
|
|
||||||
db.prepare(
|
|
||||||
`ALTER TABLE 'resources' RENAME COLUMN 'emailWhitelistEnabled2' TO 'emailWhitelistEnabled';`
|
|
||||||
).run();
|
|
||||||
})();
|
|
||||||
|
|
||||||
console.log("Migrated database");
|
|
||||||
} catch (e) {
|
|
||||||
console.log("Failed to migrate db:", e);
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`${version} migration complete`);
|
|
||||||
}
|
|
||||||
@@ -561,7 +561,7 @@ export default function Page() {
|
|||||||
</Button>
|
</Button>
|
||||||
</SettingsFormCell>
|
</SettingsFormCell>
|
||||||
{showAdvancedSettings && (
|
{showAdvancedSettings && (
|
||||||
<SettingsFormCell span="half">
|
<SettingsFormCell span="quarter">
|
||||||
<FormField
|
<FormField
|
||||||
control={
|
control={
|
||||||
form.control
|
form.control
|
||||||
|
|||||||
Reference in New Issue
Block a user