Skip to content

Commit

Permalink
Simultaneous creation of triggers, indexes, and model (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
colodenn authored Jan 13, 2025
1 parent 78026f9 commit a414de1
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"dependencies": {
"@iarna/toml": "2.2.5",
"@inquirer/prompts": "7.2.1",
"@ronin/compiler": "0.13.9",
"@ronin/compiler": "0.13.13",
"@ronin/engine": "0.0.27",
"chalk-template": "1.1.0",
"get-port": "7.1.0",
Expand Down
13 changes: 1 addition & 12 deletions tests/fixtures/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,8 @@ export const prefillDatabase = async (
): Promise<void> => {
const rootModelTransaction = new Transaction([{ create: { model: ROOT_MODEL } }]);

const triggers = models.flatMap(
(model) =>
model.triggers?.flatMap((trigger) => ({
alter: { model: model.slug, create: { trigger } },
})) ?? [],
);

const modelTransaction = new Transaction(
models
.map((model) => ({ create: { model } }))
// @ts-expect-error This is a temporay fix and will be removed as soon as create.model
// supports triggers.
.concat(triggers),
models.map((model) => ({ create: { model } })),
);

await db.query([...rootModelTransaction.statements, ...modelTransaction.statements]);
Expand Down

0 comments on commit a414de1

Please sign in to comment.