Skip to content

Commit

Permalink
update database name
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianoEger committed May 30, 2024
1 parent b1859a9 commit dcc9cee
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ jobs:
with:
node-version: 20.x
- run: npm ci
- name: Setup Database
- name: Generate Database
run: npm start generate
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const migrationConfig: Knex.MigratorConfig = {
disableMigrationsListValidation: true,
};

async function digestData(knexClient: Knex): Promise<void> {
async function digestDecoders(knexClient: Knex): Promise<void> {
try {
await createNetworks(knexClient, "decoders/network");

Expand All @@ -26,7 +26,7 @@ async function digestData(knexClient: Knex): Promise<void> {
}
}

async function setupDatabase(data: { file: string; directory: string }): Promise<void> {
async function generateDatabase(data: { file: string; directory: string }): Promise<void> {
fs.mkdirSync(data.directory, { recursive: true });

const dbPath = path.join(data.directory, data.file);
Expand All @@ -47,9 +47,9 @@ async function setupDatabase(data: { file: string; directory: string }): Promise

await knexClient.migrate.latest(migrationConfig);

await digestData(knexClient);
await digestDecoders(knexClient);

await knexClient.destroy();
}

setupDatabase({ directory: "data", file: "data.db" }).catch((error) => console.error(error));
generateDatabase({ directory: "data", file: "data.db" }).catch((error) => console.error(error));
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const fn = process.argv[2];
if (fn === "validator") {
import("./functions/tagoio-validator");
} else if (fn === "generate") {
import("./functions/setup-database");
import("./functions/generate-database");
} else {
console.log('Invalid function');
}

0 comments on commit dcc9cee

Please sign in to comment.