GithubHelp home page GithubHelp logo

Comments (10)

billy1624 avatar billy1624 commented on August 17, 2024 1

Hey @heliumbrain, I have published the fix. Please run cargo install sea-orm-cli to update the CLI.

from sea-orm.

tyt2y3 avatar tyt2y3 commented on August 17, 2024 1

I think we don't need to overdo it for now.
Ignoring _ prefix tables is a reasonable behaviour.
At most add an 'include-hidden-tables' option is fine.

from sea-orm.

billy1624 avatar billy1624 commented on August 17, 2024

Hi @heliumbrain, nice catch!

from sea-orm.

tyt2y3 avatar tyt2y3 commented on August 17, 2024

But I guess it's better for us to simply ignore table names starting with underscore

from sea-orm.

billy1624 avatar billy1624 commented on August 17, 2024

But I guess it's better for us to simply ignore table names starting with underscore

The CLI will generate an entity file named sqlx_migrations.rs for _sqlx_migrations table, with

//! src/entity/sqlx_migrations.rs
impl EntityName for Entity {
  fn table_name(&self) -> &str {
    "_sqlx_migrations"
  }
}

Together with,

//! src/entity/mod.rs
pub mod sqlx_migrations;
//! src/entity/prelude.rs
pub use super::sqlx_migrations::Entity as SqlxMigrations;

from sea-orm.

tyt2y3 avatar tyt2y3 commented on August 17, 2024

Yes but that's not what users want typically.

from sea-orm.

billy1624 avatar billy1624 commented on August 17, 2024

You mean we should skip all tables names starting with underscore?

i.e. not generating entity files for these tables

from sea-orm.

tyt2y3 avatar tyt2y3 commented on August 17, 2024

Yes that's what I meant.

from sea-orm.

billy1624 avatar billy1624 commented on August 17, 2024

Perhaps we can add an ignore option?

sea-orm-cli generate entity --ignore '^_'

With default value ^_.

Users can choose to override it by providing an empty regex expression, i.e.

sea-orm-cli generate entity --ignore ''

Or, it would be better to explicitly disable it?

sea-orm-cli generate entity --no-ignore

from sea-orm.

billy1624 avatar billy1624 commented on August 17, 2024

I think we don't need to overdo it for now.
Ignoring _ prefix tables is a reasonable behaviour.
At most add an 'include-hidden-tables' option is fine.

We can merge the PR then implement the new 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.