mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-04 22:51:42 +00:00
Migrations working
This commit is contained in:
parent
e8f10b049e
commit
1d7f4322e3
2 changed files with 130 additions and 40 deletions
|
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue