Hi all,
First off, sorry for the radio silence, just haven't been feeling motivated but I'm back and have been chipping away on a total overhaul.
Version 2.0 is here and there's a number of changes I'd like to go over.
- Exports as ES module
- Integrated testing for each DB provider using testcontainers
- Support for MySQL enums (converts to string union)
- Fluent API for node
- Mapping functions for cleaner customisation
- Modernised testing and framework using Vitest and GitHub actions
Migration Guide
Because it now exports as an ES module, consumer projects must also be of type module.
The biggest change is how the node module now works. Previously it was a couple of random functions that I never quite liked. Now, it uses a fluent API to chain operations together. See the node module docs for more details.
import { Client } from '@rmp135/sql-ts'
const config = { }
const ts = await Client
.withConfig(config)
.fetchDatabase()
.mapColumn('public.users.name', ((column, table, schema) => ({ ...column, propertyName: 'newName' })))
.toTypescript()
For CLI users, there's no specific changes required, however please report if you find anything untoward.
For those with custom templates:
- The full config is now passed in as a parameter so the previous
custom block becomes config.custom.
- The main database object is a now an object with an array of schemas, each with a
name, namespaceName and list of tables and enums.
The folder config option has been removed, just use filename with a path.
Hi all,
First off, sorry for the radio silence, just haven't been feeling motivated but I'm back and have been chipping away on a total overhaul.
Version 2.0 is here and there's a number of changes I'd like to go over.
Migration Guide
Because it now exports as an ES module, consumer projects must also be of type module.
The biggest change is how the node module now works. Previously it was a couple of random functions that I never quite liked. Now, it uses a fluent API to chain operations together. See the node module docs for more details.
For CLI users, there's no specific changes required, however please report if you find anything untoward.
For those with custom templates:
customblock becomesconfig.custom.name,namespaceNameand list of tables and enums.The
folderconfig option has been removed, just usefilenamewith a path.