Giter Site home page Giter Site logo

sea-orm-cli about sea-orm HOT 14 CLOSED

tyt2y3 avatar tyt2y3 commented on May 6, 2024
sea-orm-cli

from sea-orm.

Comments (14)

tyt2y3 avatar tyt2y3 commented on May 6, 2024 1

For the DATABASE_SCHEMA option, it should be entirely optional (it's useless in MySQL and optional in Postgres).
The default schema for Postgres is actually public
https://www.postgresql.org/docs/current/ddl-schemas.html

I would also suggest using DATABASE_URL and --database-url command line option for the sake of aligning with SQLx cli
https://crates.io/crates/sqlx-cli

from sea-orm.

tyt2y3 avatar tyt2y3 commented on May 6, 2024 1

Yes it is the intended behavior. Too bad for the confusion. I definitely think that SeaSchema MySQL should rename that parameter to database.
As per the Postgres discovery, we actually need both database and schema

from sea-orm.

tyt2y3 avatar tyt2y3 commented on May 6, 2024 1

Rename the schema to database? For sea-schema::mysql

Yes please

from sea-orm.

billy1624 avatar billy1624 commented on May 6, 2024

Ok, errors will be shown so if we cannot find / read from .env

from sea-orm.

tyt2y3 avatar tyt2y3 commented on May 6, 2024
sea-orm-cli$ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.33s                               
     Running `/mnt/c/Users/tyt2y/projects/sea-orm/target/debug/sea-orm-cli`                 
thread 'main' panicked at 'internal error: entered unreachable code: You should never see this message', sea-orm-cli/src/main.rs:18:14                                                  
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace     

We should display a welcome messge

from sea-orm.

billy1624 avatar billy1624 commented on May 6, 2024

Will redirect to -h when no subcommand is provided.

See 47bb5b3

sea-orm/sea-orm-cli on  master is 📦 v0.1.0 via 𝗥 v1.53.0 via 🅒 base
➜ cargo r
   Compiling sea-orm-cli v0.1.0 (/Applications/MAMP/htdocs/sea-orm/sea-orm-cli)
    Finished dev [unoptimized + debuginfo] target(s) in 4.61s
     Running `/Applications/MAMP/htdocs/sea-orm/target/debug/sea-orm-cli`
sea-orm 0.1.0

USAGE:
    sea-orm-cli <SUBCOMMAND>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    generate    Codegen related commands
    help        Prints this message or the help of the given subcommand(s)

from sea-orm.

tyt2y3 avatar tyt2y3 commented on May 6, 2024

DATABASE_SCHEMA should be optional

from sea-orm.

billy1624 avatar billy1624 commented on May 6, 2024

Regarding setting DATABASE_SCHEMA to optional. If I understand it correctly, the "schema" in sea-schema is actually the database in mysql connection string.

So, if DATABASE_SCHEMA is not provided, I will use anything after the last slash as the value for DATABASE_SCHEMA.

e.g. connection string mysql://sea:sea@localhost/bakery with DATABASE_SCHEMA: bakery.

from sea-orm.

billy1624 avatar billy1624 commented on May 6, 2024

Is this behavior reasonable for MySQL?

So, if DATABASE_SCHEMA is not provided, I will use anything after the last slash as the value for DATABASE_SCHEMA.

e.g. connection string mysql://sea:sea@localhost/bakery with DATABASE_SCHEMA: bakery.

from sea-orm.

tyt2y3 avatar tyt2y3 commented on May 6, 2024

MySQL does not have a concept of schema. So it's irrelevant.
We should in anycase extract the database from connection string

from sea-orm.

billy1624 avatar billy1624 commented on May 6, 2024

We should in anycase extract the database from connection string

Yes, will do so loll

from sea-orm.

billy1624 avatar billy1624 commented on May 6, 2024

Rename the schema to database? For sea-schema::mysql

from sea-orm.

tyt2y3 avatar tyt2y3 commented on May 6, 2024

To clarify, our expected behavior:

  • for MySQL --database-schema is ignored
  • for Postgres --database-schema is optional, defaults to 'public'

Please make the changes to sea-orm-cli and update the docs

from sea-orm.

billy1624 avatar billy1624 commented on May 6, 2024

The new ignore hidden table behavior for sea-orm-cli generate entity:

  • ignore table name starts with "_" (an underscore)
  • add an option --include-hidden-tables to disable this behavior

from sea-orm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.