Comments (14)
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.
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.
Rename the
schema
todatabase
? Forsea-schema::mysql
Yes please
from sea-orm.
Ok, errors will be shown so if we cannot find / read from .env
from sea-orm.
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.
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.
DATABASE_SCHEMA should be optional
from sea-orm.
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
.
sea-orm/sea-orm-cli/src/main.rs
Line 32 in 8c1b2c8
- https://github.com/SeaQL/sea-schema/blob/a235e4d4da0ca626c0c38026abb331afcc399c35/src/mysql/discovery/mod.rs#L24-L33
- https://github.com/SeaQL/sea-schema/blob/a235e4d4da0ca626c0c38026abb331afcc399c35/src/mysql/query/table.rs#L53-L81
from sea-orm.
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.
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.
We should in anycase extract the database from connection string
Yes, will do so loll
from sea-orm.
Rename the schema
to database
? For sea-schema::mysql
from sea-orm.
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.
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)
- Missing primary_key attributes when generating from a DB with partitions HOT 2
- doc: code blocks looks weird in light mode HOT 7
- Incorrect Route Matching Behavior in Actix Example Code HOT 1
- no column found for name: A_
- Missing okapi support HOT 1
- Insert to mysql, can find data inserted in mysql but the method returns with Err(RecordNotFound("Failed to find inserted item")).
- Issues with tables that do not have primary/unique keys
- Insert an active model and get back the last insert id doesn't work with autoincrement
- Enum column named "model" generates code that conflicts with the struct Model
- ambiguous associated type when access Entity::Column HOT 5
- TimestampWithTimeZone returned as array
- Allow Defaulting `string_value` For ActiveEnum Based On Renaming Rules On Variants HOT 1
- transaction use probelm with state
- Sea-ORM still includes sqlx-mysql dependency even when no mysql feature is enabled
- sea-orm-migration - Compile error using most recent version of rc2 HOT 12
- Missing downward feature `runtime-tokio`. HOT 4
- Mock Auto Increment ID Not Working for Postgres Backend Complaining About Null HOT 1
- sea-orm-cli generate error HOT 1
- .money_len type creates invalid SQL HOT 1
- Compilation error when building with sqlx-sqlite and runtime-async-std-rustls HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sea-orm.