mirror of
https://github.com/fosrl/pangolin.git
synced 2026-08-19 10:42:57 +02:00
restore script
This commit is contained in:
@@ -271,7 +271,6 @@ export default async function migration() {
|
|||||||
`ALTER TABLE 'sites' DROP COLUMN 'remoteSubnets';`
|
`ALTER TABLE 'sites' DROP COLUMN 'remoteSubnets';`
|
||||||
).run();
|
).run();
|
||||||
|
|
||||||
<<<<<<< Updated upstream
|
|
||||||
// get all of the siteResources and set the aliasAddress to 100.96.128.x starting at .8
|
// get all of the siteResources and set the aliasAddress to 100.96.128.x starting at .8
|
||||||
const siteResourcesForAlias = db
|
const siteResourcesForAlias = db
|
||||||
.prepare(
|
.prepare(
|
||||||
@@ -279,15 +278,6 @@ export default async function migration() {
|
|||||||
)
|
)
|
||||||
.all() as {
|
.all() as {
|
||||||
siteResourceId: number;
|
siteResourceId: number;
|
||||||
=======
|
|
||||||
// Associate clients with site resources based on their previous site access
|
|
||||||
// Get all client-site associations from the renamed clientSitesAssociationsCache table
|
|
||||||
const clientSiteAssociations = db
|
|
||||||
.prepare(`SELECT clientId, siteId FROM 'clientSitesAssociationsCache'`)
|
|
||||||
.all() as {
|
|
||||||
clientId: number;
|
|
||||||
siteId: number;
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
}[];
|
}[];
|
||||||
|
|
||||||
const updateAliasAddress = db.prepare(
|
const updateAliasAddress = db.prepare(
|
||||||
@@ -345,7 +335,6 @@ export default async function migration() {
|
|||||||
`INSERT INTO 'clientSiteResources' ('clientId', 'siteResourceId') VALUES (?, ?)`
|
`INSERT INTO 'clientSiteResources' ('clientId', 'siteResourceId') VALUES (?, ?)`
|
||||||
);
|
);
|
||||||
|
|
||||||
<<<<<<< Updated upstream
|
|
||||||
// create a clientSiteResourcesAssociationsCache entry for each existing association as well
|
// create a clientSiteResourcesAssociationsCache entry for each existing association as well
|
||||||
const insertClientSiteResourceCache = db.prepare(
|
const insertClientSiteResourceCache = db.prepare(
|
||||||
`INSERT INTO 'clientSiteResourcesAssociationsCache' ('clientId', 'siteResourceId') VALUES (?, ?)`
|
`INSERT INTO 'clientSiteResourcesAssociationsCache' ('clientId', 'siteResourceId') VALUES (?, ?)`
|
||||||
@@ -356,13 +345,6 @@ export default async function migration() {
|
|||||||
const siteResources = getSiteResources.all(
|
const siteResources = getSiteResources.all(
|
||||||
association.siteId
|
association.siteId
|
||||||
) as {
|
) as {
|
||||||
=======
|
|
||||||
// For each client-site association, find all site resources for that site
|
|
||||||
for (const association of clientSiteAssociations) {
|
|
||||||
const siteResources = db
|
|
||||||
.prepare(`SELECT siteResourceId FROM 'siteResources' WHERE siteId = ?`)
|
|
||||||
.all(association.siteId) as {
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
siteResourceId: number;
|
siteResourceId: number;
|
||||||
}[];
|
}[];
|
||||||
|
|
||||||
@@ -370,25 +352,15 @@ export default async function migration() {
|
|||||||
for (const siteResource of siteResources) {
|
for (const siteResource of siteResources) {
|
||||||
insertClientSiteResource.run(
|
insertClientSiteResource.run(
|
||||||
association.clientId,
|
association.clientId,
|
||||||
<<<<<<< Updated upstream
|
|
||||||
siteResource.siteResourceId
|
siteResource.siteResourceId
|
||||||
);
|
);
|
||||||
insertClientSiteResourceCache.run(
|
insertClientSiteResourceCache.run(
|
||||||
association.clientId,
|
association.clientId,
|
||||||
=======
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
siteResource.siteResourceId
|
siteResource.siteResourceId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all clients for niceId population (used later)
|
|
||||||
const clients = db
|
|
||||||
.prepare(`SELECT clientId FROM 'clients'`)
|
|
||||||
.all() as {
|
|
||||||
clientId: number;
|
|
||||||
}[];
|
|
||||||
|
|
||||||
// Associate existing site resources with their org's admin role
|
// Associate existing site resources with their org's admin role
|
||||||
const siteResourcesWithOrg = db
|
const siteResourcesWithOrg = db
|
||||||
.prepare(`SELECT siteResourceId, orgId FROM 'siteResources'`)
|
.prepare(`SELECT siteResourceId, orgId FROM 'siteResources'`)
|
||||||
|
|||||||
Reference in New Issue
Block a user