You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m interested in organising a database with postgresql schemas. This issue proposes a new flag for the cli along the lines of --split-database-schemas that splits the generated output into separate directories by schema name.
I hope to achieve:
Layout out rust modules that reflect accessing entities in the same way you reference entities in postgresql, e.g.: Rust: entities::event::signin::Model, SQL: event.signin.
Maintain the relationships across schemas via codgen.
For example:
CREATESCHEMAIF NOT EXISTS event;
CREATETABLEpublic.user (
id SERIALPRIMARY KEY,
username VARCHAR(50) NOT NULL UNIQUE,
password_hash VARCHAR(255) NOT NULL
);
CREATETABLEevent.signin (
id SERIALPRIMARY KEY,
user_id INTEGERNOT NULL,
signin_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
ip_address INET,
user_agent TEXT,
FOREIGN KEY (user_id) REFERENCESpublic.user(id) ON DELETE CASCADE
);
Using sea-orm-cli generate entity --with-serde both, the code below is generated:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I’m interested in organising a database with postgresql schemas. This issue proposes a new flag for the cli along the lines of
--split-database-schemas
that splits the generated output into separate directories by schema name.I hope to achieve:
entities::event::signin::Model
, SQL:event.signin
.For example:
Using
sea-orm-cli generate entity --with-serde both
, the code below is generated:I am happy for any feedback and to do the implementation.
Beta Was this translation helpful? Give feedback.
All reactions