-
Hi, I'm just l learning SeaQL ecosystem, and, if I read the docs correctly, in all migrations I have to use the original Entity in order to describe how to create/modify the tables, like so
All these Is there a proper way to write self-contained migrations with Sea-Schema? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
After some digging inside the SeaSchema`s code I found a solution that does the job, although it's a bit verbose. I wonder if something like this should be added to the docs. Table::create()
.table(TableRef::Table(Alias::new("my_table_name").into_iden()))
.if_not_exists()
.col(
ColumnDef::new(Alias::new("id"))
.integer()
.not_null()
.auto_increment()
.primary_key(),
)
.col(ColumnDef::new(Alias::new("title")).string().not_null())
... The Respect to all authors for a great project! You're totally going in the right direction. |
Beta Was this translation helpful? Give feedback.
-
Thank you for the input. Actually you can take a look into the https://github.com/SeaQL/sea-orm/tree/master/examples
|
Beta Was this translation helpful? Give feedback.
-
Developers have different expectations on this messy matters and I can only say every approach is fine but you need to have that thought out. |
Beta Was this translation helpful? Give feedback.
After some digging inside the SeaSchema`s code I found a solution that does the job, although it's a bit verbose. I wonder if something like this should be added to the docs.
The
TableRef
enum also offers a variety of other options to specify the table.Respect to all authors for a great project! You're totally going in the right direction.