mirror of
https://github.com/fosrl/pangolin.git
synced 2025-12-16 13:06:27 +00:00
Migrations working
This commit is contained in:
@@ -327,6 +327,11 @@ export default async function migration() {
|
||||
`INSERT INTO 'clientSiteResources' ('clientId', 'siteResourceId') VALUES (?, ?)`
|
||||
);
|
||||
|
||||
// create a clientSiteResourcesAssociationsCache entry for each existing association as well
|
||||
const insertClientSiteResourceCache = db.prepare(
|
||||
`INSERT INTO 'clientSiteResourcesAssociationsCache' ('clientId', 'siteResourceId') VALUES (?, ?)`
|
||||
);
|
||||
|
||||
// For each client-site association, find all site resources for that site
|
||||
for (const association of clientSiteAssociations) {
|
||||
const siteResources = getSiteResources.all(
|
||||
@@ -341,6 +346,10 @@ export default async function migration() {
|
||||
association.clientId,
|
||||
siteResource.siteResourceId
|
||||
);
|
||||
insertClientSiteResourceCache.run(
|
||||
association.clientId,
|
||||
siteResource.siteResourceId
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user