121492b303
fix(cli): sort migrations lexicographically for real
2024-01-22 13:48:09 +01:00
a4da353d5a
feat(cli): add graceful process abort
...
Using an AbortSignal and Promise.race we abandon running migrations that take longer to complete after the process is aborted than the given abortRespite period
2024-01-22 11:30:06 +01:00
98adcda37e
fix(reporters): use better wording in the header in the default reporter
...
Also show the number of skipped migrations
2024-01-19 13:43:59 +01:00
f515c8a854
feat(cli): add --no-execution option to the "up" command
...
...which can be used to log manually run migrations as successful or for baselining a database.
2024-01-19 13:43:59 +01:00
e71c318ea5
test(up): structure the up tests in a better way
2024-01-19 13:43:59 +01:00
9ef0fa2776
feat(cli): add --from and --to options to limit what migrations to run
2024-01-19 13:43:59 +01:00
02c142e39a
feat(up): add --limit option to limit the number of migrations to run
2024-01-19 13:43:59 +01:00
bf4d596980
fix(cli): clarify which options that takes parameters
2024-01-19 13:43:59 +01:00
73a8a42e5f
fix(history): support a migration history with entries without file extensions (.js is assumed in such case)
2024-01-18 15:18:35 +01:00
83dc618c2e
fix(cli): remove --enable-source-maps flag
2024-01-18 10:46:04 +01:00
9a605a85f1
feat: add support for TypeScript migration files
...
And add a guide to the documentation on how to set it up for NodeJS
2023-12-20 15:27:03 +01:00
9f91bdcfa0
feat(cli): add the --import option for importing modules/packages before commands are run
...
Can for instance be used to load environment variables using Dotenv
2023-12-20 11:08:27 +01:00
e6e4433018
feat(cli): rename extension short option from -e to -x
...
BREAKING CHANGE: if you've been using the `-e` short option you should change it to `-x` or use the long option name `--extension`
2023-12-20 09:27:43 +01:00
f9a16d87a1
feat: add color option to CLI and configuration file
...
The option is used to force enable/disable color output and is passed to the reporter which should respect it
2023-12-20 09:11:01 +01:00
beb6cf7719
chore(deps): upgrade ansis package
2023-12-19 14:34:54 +01:00
ce6946cac4
feat: support for Bun
2023-12-19 14:06:00 +01:00
17c4723bb8
feat(postgres): implement the first version of the PostgreSQL plugin
2023-12-19 13:27:57 +01:00
cae6d11d53
feat(types): move Emigrate types to separate package and improve types ( #41 )
...
* feat(types): move Emigrate types to separate package
Also refactor the types to use discriminating unions for easier error handling and such.
Errors passed to storage plugins should now be serialized and storage plugins are expected to return already serialized errors on failed history entries.
* fix(mysql): handle the new type changes
* fix(storage-fs): handle the new type changes
* feat(cli): better error handling and types
Adapt to the new types from the @emigrate/types package, like discriminating union types and serializing and deserializing errors
2023-12-15 13:03:35 +01:00
1434be5d5e
feat(reporter): print Emigrate CLI's version number and relative paths to migrations ( #39 )
...
* feat(reporter-default): print CLI version number
* feat(reporter-default): print relative paths to migrations instead of only the file names
This makes the output clickable in most shells
* feat(reporter-pino): include the Emigrate CLI version in each log
2023-12-14 13:45:02 +01:00
bad4e252f3
feat(reporters): pass the CLI's version number to reporters ( #38 )
2023-12-14 13:11:55 +01:00
2b9a16d6fd
fix(cli): make main command non-strict to let other commands handle their options ( #37 )
2023-12-14 11:47:36 +01:00
960ce08674
feat(cli): add --help and --version options to main command ( #35 )
2023-12-14 10:49:54 +01:00
8cc43a8f83
refactor(cli): introduce the migration-runner helper for less code duplication and fewer return paths
...
Thanks to the migration-runner the "up" and "list" commands are now very similar code wise
2023-12-12 15:47:37 +01:00
5307e87242
fix(list): don't log info about locked migrations as it doesn't happen in this command
2023-12-12 15:38:24 +01:00
bc33e63e3e
feat(reporter-default): improve error logging by logging all own properties of the errors
2023-12-12 15:36:30 +01:00
e7288fcbfb
test(up): add more tests for the "up" command
2023-12-08 13:47:36 +01:00
703e6f028a
feat(storage): add "end" method to storage for cleaning up resources when commands are finished
2023-12-08 13:01:46 +01:00
a8db22680e
feat(up): handle storage initialization errors and present missing loader errors in a better way
2023-12-08 13:01:45 +01:00
c1d55978d7
feat(up): serialize errors before passing them to storage plugins
2023-12-08 13:01:45 +01:00
43a220d633
test(up): start writing some tests for the "up" command
2023-12-07 10:48:02 +01:00
d8a6a2428a
feat(remove): implement the "remove" command for removing migrations from the history
2023-11-24 15:45:17 +01:00
9447d28ad8
fix(history): don't let different migration directories interfere with each other even though they share storage
2023-11-24 11:10:01 +01:00
cf17e48f25
feat(cli): enable source maps
2023-11-24 10:55:58 +01:00
8347fc1fa4
feat(up): improve error handling and presentation
2023-11-22 15:47:17 +01:00
b57c86eaab
fix(up): only load the JavaScript loader plugin if necessary
2023-11-22 15:40:53 +01:00
c68c6f0490
feat(cli): include Emigrate error codes in error names
2023-11-22 15:34:05 +01:00
570bd1fa2b
feat(cli): make the default reporter print the full command output when done
...
In interactive mode the output is normally clipped to the number of lines that the current terminal window can show without scrolling
so to remedy that the full command output is now printed to the console when done
2023-11-22 14:35:38 +01:00
8f623efd45
feat(cli): ignore letter casing of commands
2023-11-22 14:35:37 +01:00
53cdb23237
feat(cli): implement the "list" command for listing migration history and pending migrations
2023-11-22 14:35:37 +01:00
d4d87036df
refactor(cli): move commands to a separate folder
2023-11-22 14:35:36 +01:00
4f8fb441f8
refactor(cli): move the default reporter into a separate "reporters" folder
2023-11-22 14:35:35 +01:00
da1eee3c75
feat(cli): add "reporter" option for the "new" command for improved logging
2023-11-22 14:35:35 +01:00
1940885134
fix(cli): remove the double period before file extension in new migration files
2023-11-22 14:35:35 +01:00
8e87ade5c0
feat(cli): storage and reporter are now their own options
...
Instead of mixing storages and reporters with other plugins in the plugin option they now have their own separate options.
This is for increased future flexibility and to be more similar to other CLI tools.
BREAKING CHANGE: the storage to use must now be specified using the "storage" configuration option or the "--storage" CLI option instead of having it among other plugins.
2023-11-22 14:35:35 +01:00
59ec16b87b
feat(cli): improve "up" command output and flow a lot
2023-11-17 12:50:35 +01:00
8f35812fed
feat(cli): add support for "reporter" plugins and include a default reporter
2023-11-17 12:50:33 +01:00
30a448b4cf
feat(cli): improve error handling with more custom Error instances
2023-11-16 12:01:32 +01:00
8dadfe9a5b
feat(cli): support NodeJS callback style migration functions
2023-11-16 11:24:00 +01:00
46b9104cda
fix(cli): don't run any migrations if any previous migration have failed
2023-11-16 10:59:54 +01:00
3b36b3de52
feat(cli): implement a default "loader" for JavaScript files
...
Supports any of the `.js`, `.cjs` and `.mjs` file extensions
2023-11-16 10:58:35 +01:00