72 Commits

Author SHA1 Message Date
Billy Chan
bf67d827a5
Fix clippy 2023-01-30 11:34:40 +08:00
Chris Tsang
a9aa139af2
Enable --universal-time by default (#1420)
* Enable --universal-time by default

* Add `--local-time` flag

---------

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2023-01-29 10:56:46 +08:00
Billy Chan
71dbffc725
Fix clippy (#1426)
* Fix clippy

* Fix clippy
2023-01-27 18:50:20 +08:00
Billy Chan
9fbfd06663
[CLI] a warm welcome message included :) (#1417)
* [CLI] a warm welcome message included :)

* Update layout

* update layout
2023-01-27 12:44:40 +08:00
Chris Tsang
b84c2ffdcb Revert "Enable --universal-time by default"
This reverts commit 25bc625fc034a0e02b9e42864ddb74c8d51c6623.
2023-01-24 14:02:01 +08:00
Chris Tsang
25bc625fc0
Enable --universal-time by default 2023-01-24 14:00:47 +08:00
Diwakar Gupta
9c6e5c1fa2
Fixed sea-orm-cli exit status (#1402) 2023-01-19 15:40:29 +08:00
Billy Chan
cbd7a8d1c9
Cleanup the use of vec![] (#1367)
* Public methods accept any IntoIterator as argument

* refactoring
2023-01-11 14:17:06 +08:00
Billy Chan
384ac1bea6
Cont. sea-orm-cli Implement derives & attributes parameters for entity generation (#1321)
* sea-orm-cli Implement derives & attributes parameters for entity generation (#1124)

* implement derives & attributes for cli

* fmt and clippy fix

* use comma delimiter for attributes arg

* Update help message use `'` instead of `"` to quote

* Refactoring

* remove unnecessary cloning

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>

* [CLI] generate model with extra derives and attributes

* clippy

Co-authored-by: Isaiah Gamble <77396670+tsar-boomba@users.noreply.github.com>
2022-12-20 12:59:42 +08:00
Billy Chan
9282ce2ded
Cont. Add serde skip options for hidden columns to the CLI (#1320)
* Add serde skip options for hidden columns to the CLI (#1171)

* Add serde skip options for hidden columns to the CLI

* Resolve rustfmt and clippy issues

* Use SerdeDeriveOptions instead of WithSerde in tests

* Resolve upstream conflict

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>

* [CLI] serde_skip_hidden_column

* clippy

* clippy

Co-authored-by: Jacob Trueb <jtrueb@northwestern.edu>
2022-12-20 00:43:21 +08:00
Billy Chan
3f00725ee2
Cli serde skip deserialize for primary key option (#1186) (#1318)
* Cli serde skip deserialize for primary key option (#1186)

* Add CLI option to skip primary keys with serde

Implements: https://github.com/SeaQL/sea-orm/issues/841

* Codegen: fix tests

* complete skip_deserialize cli feature

* run fmt

* fix tests

Co-authored-by: witcher <witcher@wiredspace.de>

* [cli] should be `#[serde(skip_deserializing)]`

* [CLI] code refactor

* [cli] rename

Co-authored-by: Isaiah Gamble <77396670+tsar-boomba@users.noreply.github.com>
Co-authored-by: witcher <witcher@wiredspace.de>
2022-12-19 22:11:45 +08:00
Billy Chan
b2185af559
Cleaning up dependency (#1300)
* Dependency version cleanup

* Update build tool

* Disable default features

* [cli] disable default features
2022-12-16 15:52:00 +08:00
Billy Chan
d32e1eb058
[CLI] fixup - generate entity file for all tables by default (#1251) 2022-11-24 20:21:52 +08:00
Billy Chan
d30a5612f8
[CLI] generate entity file for specified tables only (full text matching, not substring matching) (#1245) 2022-11-24 12:21:16 +08:00
Billy Chan
d6ca491d80
[CLI] Generate entity Postgres connection with schema search path (#1212) 2022-11-09 15:01:44 +08:00
Billy Chan
9dfc481c3b
Fix clippy warnings (#1188)
* Fix clippy warnings

* More fixes
2022-11-04 19:14:31 +08:00
Billy Chan
9108e74dac
Fix conflicting short flag -u when executing sea-orm-cli migrate generate command (#1157) 2022-10-26 21:01:24 +08:00
Billy Chan
32061e30b5
Added check to make sure migration name is valid (#1155)
Co-authored-by: Forest Anderson <forestkzanderson@gmail.com>
2022-10-26 18:19:51 +08:00
Rheydskey
9f2eb3d46c
Add cli feature on sea-orm-migration (#978)
* Add cli feature on sea-orm-migration

* Add cli feature on sea-orm-cli

* Remove async-std feature and add async-std in the default feature

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2022-10-26 17:48:06 +08:00
Billy Chan
cb76b8f443
[cli] migrate up should apply all pending migrations (#1010) 2022-10-26 17:21:24 +08:00
Billy Chan
b22db842e4
Run migrations on PostgreSQL schema (#1056)
* Run migrations on PostgreSQL schema

* fmt

* fmt & clippy

* clippy

* [cli] update helper text
2022-10-17 17:16:00 +08:00
Horu
d9ac2f1509
fix(deps): dotenv -> dotenvy (#1085) 2022-10-05 23:19:48 +08:00
Animesh Sahu
ad5e8c1264
[cli] Add -u, --universal-time option in generate to use Utc instead of Local (#947) 2022-09-25 10:33:50 +08:00
Horu
6816e86f4d
[cli] Add -l/--lib flag (#953)
* [cli] Add `-l`/`--lib` flag

* [cli] Change function name to reflect functionality
2022-09-25 10:31:26 +08:00
Daniel Porteous (dport)
d77cf24e06
Fix typos in ORM CLI help messages (#1060) 2022-09-23 15:36:10 +08:00
Remo Senekowitsch
be0d846d8f
Enable migration generation in modules (#933)
* Enable migration generation in modules

Previously, migration generation expected migrations
to be at the crate root.

* Fix migration backup file extension

* Document behavior of migration_dir
2022-09-19 23:42:46 +08:00
Billy Chan
43495de0aa
Fix clippy warnings - 1 (#967)
* Fix clippy warnings

* cargo fmt

* Fix clippy warnings

* cargo fmt
2022-08-12 20:02:53 +08:00
Igor
0d94941c3b
Fix typos (#958) 2022-08-12 18:31:35 +08:00
Erik Rhodes
5fbc336de0 [cli] added with-copy-enums flag to cli and conditional derive 2022-08-06 16:45:28 +08:00
Billy Chan
c4fa40ab3e
[cli] migrator CLI handles init and generate commands 2022-08-02 16:30:49 +08:00
Billy Chan
60bf6da8dd
sea-orm-cli migrate generate should take file name as argument instead of option (#870) 2022-07-14 17:43:21 +08:00
Billy Chan
c5aa63e282
Generate entity files with PostgreSQL's schema name (#422)
* feat(codegen): generate entity files with PostgreSQL's schema name

* Ignore schema name `public`

* Restore changes

* Fix test cases

* cargo fmt

* [cli] fixup
2022-07-11 23:11:04 +08:00
Chris Tsang
4aaabacae3 Fix clippy 2022-07-11 00:42:42 +08:00
Billy Chan
1fc156288e
[cli] skip checking connection string contains username and host (#851) 2022-07-10 23:03:33 +08:00
Nahua
a1bf662fc3
#661: Add flag to sea-orm-cli to generate code for time crate (#724)
* Implement entity writer context and date time crate enum

* Use entity writer context to render correct rust type according to chrono/time enum

* Add unit test to get col rs type with time crate

* Add date-time-crate flag for cli

* Edit usage of updated get_rs_type method

* Use arg enum for date time crate

* Move date time crate arg enum conversion into commands module

* Directly use arg enum

* Fixing import issues for arg enum w/ help from Billy
2022-07-10 15:22:47 +08:00
Billy Chan
cecf4545cb
cargo fmt 2022-07-08 14:48:04 +08:00
Billy Chan
e0eb8ecf69
[cli] skip generating entity for ignored tables (#837) 2022-07-05 01:19:36 +08:00
Billy Chan
1c4acf1402
[cli] remove unused code 2022-07-04 17:36:58 +08:00
Billy Chan
1054d6451c
Use file!() macro to avoid manually defining the name of migration (#736)
* Add `DeriveMigrationName`

* CLI migrate generate without replacing migration name

* Update migrations

* Fixup
2022-06-29 00:42:59 +08:00
smonv
580fa90023
Bump clap version to 3.2 (#706)
* bump clap to 3.1.17

sea-orm-migration: bump clap version to 3.1.17

sea-orm-cli: use clap derive API instead of builder API

sea-orm-migration: use clap derive

* Fix clippy warnings

* Migration CLI verbose with default value

* bump clap to 3.2

Co-authored-by: Thanh Van <tvt@smonv.com>
Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2022-06-26 20:52:33 +08:00
kyoto7250
0ce8ee6a31
feat(sea-orm-cli): output log about generated file name. (#735)
* feat(sea-orm-cli): output lof about  generated file name.

https://github.com/SeaQL/sea-orm/issues/722

* include column names in info

* cargo fmt

* Update sea-orm-cli/src/commands.rs

Avoid multiple initializations

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>

* show info per column

* refactor: use write! macro

* Refactoring

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2022-06-12 20:30:49 +08:00
Billy Chan
9d2cae44b3
Migrator CLI Fixup (#708)
* CI compile migrator CLI

* sea-orm-migration's CLI with only migration subcommand

* Fix clippy warnings

* Fixup

* `sea-orm-cli migrate init`: write sea-orm-migration version based on CLI version
2022-05-10 23:24:23 +08:00
Chris Tsang
1283d9d325 Tweaks 2022-05-09 21:39:41 +08:00
Viktor Bahr
3518acf1b9
CLI command to generate a new migration (#656)
* feat(cli): add 'migration generate' subcommand

This subcommend will create a new, empty migration.

* feat(deps): add chrono crate

This crate will allow me to fetch the current date and time required for
generating the migration filename.

* feat(cli): generate migration filename

* feat(cli): read template, replace migration name

* feat(cli): write modified content to file

* feat(deps): add regex crate

Allows me to parse the lib.rs file containing the migrator logic.

* fix(cli): add missing chrono import

* feat(cli): mod declaration for new migration

This modifies the existing migator file, adding a module declaration for
the newly generated migration.

* feat(cli): regenerate migration vector

* feat(cli): write updated migrator file to disk

This completes updating the migrator file with the new migration
information.

* docs(cli): additional docstring

* refactor(cli): move logic into functions

* test(cli): create new migration happy path

* test(cli): update migrator happy path

* fix(cli): dedicated tmp dir for test

This avoids conflicts with the other tests.

* style(cli): align generated code with cargofmt

As suggested by @billy1624 in the review of #656.

* feat(cli): harden regex against extra spaces

As suggested by @billy1624 in the review of #656.

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2022-05-09 21:31:12 +08:00
Chris Tsang
c466e46ae0 Fix tests 2022-05-09 14:44:12 +08:00
Chris Tsang
75d5c0f5ea Restructure sea-orm-cli & sea-orm-migration 2022-05-09 12:30:58 +08:00
Billy Chan
498c0154ca Restructure SeaORM migration
Bump codegen's sea-query version [cli]

Update CLI subcommand method

Move migration utility into sea-orm-migration
2022-05-09 12:30:55 +08:00
benluelo
b01d4887ca
Add max_connections option to CLI (#670)
Change max_connections option to default to 1

CLI generate entity with default max connection of 1
2022-04-26 22:55:24 +08:00
Alex
fe1877a49d
sea as an alternative bin name to sea-orm-cli (#558)
* Simplify bin name from  sea-orm-cli to sea

* -S

* fixed test
2022-03-26 18:06:14 +08:00
Billy Chan
0a06892aac Fix [cli] cargo publish failed 2022-02-07 20:55:16 +08:00