mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-12 10:27:06 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
935593885a | ||
|
|
3fcfd3304f |
@@ -44,6 +44,7 @@ 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
|
||||||
@@ -85,7 +86,8 @@ 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;
|
||||||
|
|
||||||
|
|||||||
@@ -680,6 +680,16 @@ 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(
|
||||||
@@ -699,13 +709,7 @@ 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) {
|
||||||
|
|||||||
59
server/setup/scriptsSqlite/1.19.1.ts
Normal file
59
server/setup/scriptsSqlite/1.19.1.ts
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
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="quarter">
|
<SettingsFormCell span="half">
|
||||||
<FormField
|
<FormField
|
||||||
control={
|
control={
|
||||||
form.control
|
form.control
|
||||||
|
|||||||
Reference in New Issue
Block a user