Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read schema from file #148

Closed
renne opened this issue Jul 17, 2024 · 1 comment
Closed

Read schema from file #148

renne opened this issue Jul 17, 2024 · 1 comment

Comments

@renne
Copy link

renne commented Jul 17, 2024

Currently a database container has to be started and the SQL-schema has to be imported to read the SQL-schema with sql-ts.
This is quite time consuming in software development.

I suggest an option to read the SQL-schema directly from a file including CREATE TABLE statements.

@rmp135
Copy link
Owner

rmp135 commented Aug 4, 2024

I have no intention of importing directly from CREATE statements. However it does support reading from a definition object file so the database doesn't have to be online. This is really meant for an intermediary step, not as the primary way of generating the definitions.

// Fetch database schema once using a config.

const asObject = await Client
  .fromConfig(config)
  .fetchDatabase()
  .toObject()

// Serialise the output, then the file can be modified and reimported without the db.

const definition = await Client
  .fromObject(asObject, config)
  .toTypescript()

@rmp135 rmp135 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants