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
[workspace]
resolver = "2"members = [
"app",
"migration",
"entity",
]
[workspace.package]
edition = "2021"rust-version = "1.80"
[workspace.dependencies]
sea-orm = { version = "^0.12.0", features = [ "sqlx-mysql", "runtime-tokio-rustls", "macros" ] }
tokio = { version = "1.39.3", features = ["full"] }
Coming to the actual problem
After running the migrations which only contains the following code:
use sea_orm_migration::{prelude::*, schema::*};#[derive(DeriveMigrationName)]pubstructMigration;#[async_trait::async_trait]implMigrationTraitforMigration{asyncfnup(&self,manager:&SchemaManager) -> Result<(),DbErr>{// Replace the sample below with your own migration scripts
manager
.create_table(Table::create().table(Event::Table).if_not_exists().col(pk_auto(Event::Id)).col(string(Event::Name)).col(date(Event::Date)).to_owned(),).await}asyncfndown(&self,manager:&SchemaManager) -> Result<(),DbErr>{// Replace the sample below with your own migration scripts
manager
.drop_table(Table::drop().table(Event::Table).to_owned()).await}}#[derive(DeriveIden)]enumEvent{Table,Id,Name,Date,}
after the successful migration I tried to generate the entities.
[nix-shell:~/Code/website/code]$ RUST_BACKTRACE=1 sea generate entity -o entity/src/ -v -l
Connecting to MySQL ...
2024-09-11T16:57:39.288053Z DEBUG sqlx::query: summary="SET sql_mode=(SELECT CONCAT(@@sql_mode, ',PIPES_AS_CONCAT,NO_ENGINE_SUBSTITUTION')),time_zone='+00:00',NAMES …" db.statement="\n\nSET\n sql_mode =(\n SELECT\n CONCAT(\n @ @sql_mode,\n ',PIPES_AS_CONCAT,NO_ENGINE_SUBSTITUTION'\n )\n ),\n time_zone = '+00:00',\n NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;\n" rows_affected=0 rows_returned=0 elapsed=469.899µs elapsed_secs=0.000469899
Discovering schema ...
2024-09-11T16:57:39.289161Z DEBUG sqlx::query: summary="SELECT version()" db.statement="" rows_affected=0 rows_returned=1 elapsed=685.18µs elapsed_secs=0.00068518
2024-09-11T16:57:39.292582Z DEBUG sqlx::query: summary="SELECT `table_name`, `engine`, `auto_increment`, …" db.statement="\n\nSELECT\n `table_name`,\n `engine`,\n `auto_increment`,\n `table_collation`,\n `table_comment`,\n `create_options`,\n `collation_character_set_applicability`.`character_set_name`\nFROM\n `information_schema`.`tables`\n LEFT JOIN `information_schema`.`collation_character_set_applicability` ON `collation_character_set_applicability`.`collation_name` = `tables`.`table_collation`\nWHERE\n `table_schema` = ?\n AND `table_type` IN (?, ?)\nORDER BY\n `table_name` ASC\n" rows_affected=0 rows_returned=2 elapsed=2.736612ms elapsed_secs=0.002736612
thread 'main' panicked at /home/stennsen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sqlx-core-0.7.4/src/row.rs:72:37:
called `Result::unwrap()` on an `Err` value: ColumnDecode { index: "6", source: UnexpectedNullError }
stack backtrace:
0: rust_begin_unwind
1: core::panicking::panic_fmt
2: core::result::unwrap_failed
3: <sea_schema::mysql::query::table::TableQueryResult as core::convert::From<&sqlx_mysql::row::MySqlRow>>::from
4: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
5: sea_orm_cli::commands::generate::run_generate_command::{{closure}}
6: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current
7: <futures_lite::future::Or<F1,F2> as core::future::future::Future>::poll
8: async_io::driver::block_on
9: async_global_executor::executor::block_on
10: async_std::task::builder::Builder::blocking
11: sea::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Which results in some sqlx-core related error.
I searched for similar problems in this repo but wasn't able to find anything like this.
Am I missing something? Is sea-orm not made for this kind of project layout? Or is that an actual bug I should create an issue for? I also checked via adminer, whether everything looks like it should and the table exists...
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
-
Hello there,
I trying to get started with sea-orm but I am struggling with the entity generation.
Setup
I am using a cargo workspaces layout looking somewhat like this:
with MariaDB as a database running in the background.
I installed
sea-orm-cli v1.0.1
migration/Cargo.toml
looks like this:and
enity/Cargo.toml
looking like this:while my top level Cargo.toml contains is this:
Coming to the actual problem
After running the migrations which only contains the following code:
after the successful migration I tried to generate the entities.
Which results in some sqlx-core related error.
I searched for similar problems in this repo but wasn't able to find anything like this.
Am I missing something? Is sea-orm not made for this kind of project layout? Or is that an actual bug I should create an issue for? I also checked via adminer, whether everything looks like it should and the table exists...
Beta Was this translation helpful? Give feedback.
All reactions