How to use the graphback.DatabaseSchemaManager function in graphback

To help you get started, we’ve selected a few graphback examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aerogear / graphql-testx / src / graphback-core / index.ts View on Github external
export async function generateDatabase(
  model: string,
  config: { [id: string]: any },
) {
  const backend: GraphQLBackendCreator = new GraphQLBackendCreator(
    model,
    config,
  );

  const connectionConfig = {
    filename: `${folders.database}/db.sqlite`,
  };

  const manager = new DatabaseSchemaManager("sqlite3", connectionConfig);
  backend.registerDataResourcesManager(manager);

  await backend.createDatabase();
}
github aerogear / graphql-testx / src / BackendBuilder.ts View on Github external
private async generateDatabase(): Promise {
    const manager = new DatabaseSchemaManager("sqlite3", {
      filename: ":memory:"
    });
    this.backendCreator.registerDataResourcesManager(manager);
    await this.backendCreator.createDatabase();
    return manager.getConnection();
  }
}