sea-orm
sea-orm copied to clipboard
`comment()` does not work in migrations
Description
I am using the βcomment()β option in the migrations but when I run it, it does nothing, it does not add the comments.
manager
.create_table(
Table::create()
.table(AnimeFavorites::Table)
.if_not_exists()
.col(pk_uuid(AnimeFavorites::Id))
.col(
integer(AnimeFavorites::AnimeId)
.not_null()
.comment("ID of the anime within the platform from which your data was obtained."),
)
.col(
integer(AnimeFavorites::UserId)
.not_null()
.comment("ID of the user who marked it as a favorite. This is a many to one relationship."),
)
.col(
string(AnimeFavorites::Platform)
.custom(AnimePlatforms::Enum)
.comment("Name of the platform from which the information about the anime was obtained."),
)
.to_owned(),
)
.await?;
Steps to Reproduce
- Create a migration
- Use the
comment()function when create a table column - View the migration execution logs and see that the comments are missing.
Expected Behavior
Besides creating the columns, tables, etc., the assigned comments are also added.
Actual Behavior
Comments are not assigned to columns.
Reproduces How Often
Yes. Create a migration.
Workarounds
Reproducible Example
manager
.create_table(
Table::create()
.table(AnimeFavorites::Table)
.if_not_exists()
.col(pk_uuid(AnimeFavorites::Id))
.col(
integer(AnimeFavorites::AnimeId)
.not_null()
.comment("ID of the anime within the platform from which your data was obtained."),
)
.col(
integer(AnimeFavorites::UserId)
.not_null()
.comment("ID of the user who marked it as a favorite. This is a many to one relationship."),
)
.col(
string(AnimeFavorites::Platform)
.custom(AnimePlatforms::Enum)
.comment("Name of the platform from which the information about the anime was obtained."),
)
.to_owned(),
)
.await?;
2024-10-28T15:51:02.341923Z INFO Database startup: database: Running migrations...
2024-10-28T15:51:02.346621Z INFO Database startup: sqlx::query: summary="CREATE TABLE IF NOT β¦" db.statement="\n\nCREATE TABLE IF NOT EXISTS \"seaql_migrations\" (\n \"version\" varchar NOT NULL PRIMARY KEY,\n \"applied_at\" bigint NOT NULL\n)\n" rows_affected=0 rows_returned=0 elapsed=3.216901ms elapsed_secs=0.003216901
2024-10-28T15:51:02.346694Z INFO Database startup: sea_orm_migration::migrator: Applying all pending migrations
2024-10-28T15:51:02.347015Z INFO Database startup: sqlx::postgres::notice: relation "seaql_migrations" already exists, skipping
2024-10-28T15:51:02.347939Z INFO Database startup: sqlx::query: summary="CREATE TABLE IF NOT β¦" db.statement="\n\nCREATE TABLE IF NOT EXISTS \"seaql_migrations\" (\n \"version\" varchar NOT NULL PRIMARY KEY,\n \"applied_at\" bigint NOT NULL\n)\n" rows_affected=0 rows_returned=0 elapsed=300.909Β΅s elapsed_secs=0.000300909
2024-10-28T15:51:02.348231Z INFO Database startup: sqlx::postgres::notice: relation "seaql_migrations" already exists, skipping
2024-10-28T15:51:02.349154Z INFO Database startup: sqlx::query: summary="CREATE TABLE IF NOT β¦" db.statement="\n\nCREATE TABLE IF NOT EXISTS \"seaql_migrations\" (\n \"version\" varchar NOT NULL PRIMARY KEY,\n \"applied_at\" bigint NOT NULL\n)\n" rows_affected=0 rows_returned=0 elapsed=242.94Β΅s elapsed_secs=0.00024294
2024-10-28T15:51:02.349450Z INFO Database startup: sqlx::postgres::notice: relation "seaql_migrations" already exists, skipping
2024-10-28T15:51:02.350304Z INFO Database startup: sqlx::query: summary="CREATE TABLE IF NOT β¦" db.statement="\n\nCREATE TABLE IF NOT EXISTS \"seaql_migrations\" (\n \"version\" varchar NOT NULL PRIMARY KEY,\n \"applied_at\" bigint NOT NULL\n)\n" rows_affected=0 rows_returned=0 elapsed=249.743Β΅s elapsed_secs=0.000249743
2024-10-28T15:51:02.351720Z INFO Database startup: sqlx::query: summary="SELECT \"version\", \"applied_at\" FROM β¦" db.statement="\n\nSELECT\n \"version\",\n \"applied_at\"\nFROM\n \"seaql_migrations\"\nORDER BY\n \"version\" ASC\n" rows_affected=0 rows_returned=0 elapsed=788.613Β΅s elapsed_secs=0.000788613
2024-10-28T15:51:02.351975Z INFO Database startup: sea_orm_migration::migrator: Applying migration 'm20240827_154646_settings_user'
2024-10-28T15:51:02.353100Z INFO Database startup: sqlx::query: summary="CREATE TYPE \"user_status\" AS β¦" db.statement="\n\nCREATE TYPE \"user_status\" AS ENUM ('disabled', 'active')\n" rows_affected=0 rows_returned=0 elapsed=652.886Β΅s elapsed_secs=0.000652886
2024-10-28T15:51:02.357424Z INFO Database startup: sqlx::query: summary="CREATE TABLE IF NOT β¦" db.statement="\n\nCREATE TABLE IF NOT EXISTS \"user_settings\" (\n \"id\" bigserial NOT NULL PRIMARY KEY,\n \"created_at\" timestamp with time zone NOT NULL NOT NULL DEFAULT 'NOW()',\n \"updated_at\" timestamp with time zone NOT NULL NOT NULL DEFAULT 'NOW()',\n \"status\" user_status NOT NULL\n)\n" rows_affected=0 rows_returned=0 elapsed=2.196739ms elapsed_secs=0.002196739
2024-10-28T15:51:02.357499Z INFO Database startup: sea_orm_migration::migrator: Migration 'm20240827_154646_settings_user' has been applied
2024-10-28T15:51:02.358735Z INFO Database startup: sqlx::query: summary="INSERT INTO \"seaql_migrations\" (\"version\", β¦" db.statement="\n\nINSERT INTO\n \"seaql_migrations\" (\"version\", \"applied_at\")\nVALUES\n ($1, $2)\nRETURNING\n \"version\"\n" rows_affected=1 rows_returned=1 elapsed=608.241Β΅s elapsed_secs=0.000608241
2024-10-28T15:51:02.358787Z INFO Database startup: sea_orm_migration::migrator: Applying migration 'm20240829_223902_settings_anime_entity_and_relations'
2024-10-28T15:51:02.359611Z INFO Database startup: sqlx::query: summary="CREATE TYPE \"anime_platforms\" AS β¦" db.statement="\n\nCREATE TYPE \"anime_platforms\" AS ENUM ('MAL')\n" rows_affected=0 rows_returned=0 elapsed=443.489Β΅s elapsed_secs=0.000443489
2024-10-28T15:51:02.362624Z INFO Database startup: sqlx::query: summary="CREATE TABLE IF NOT β¦" db.statement="\n\nCREATE TABLE IF NOT EXISTS \"anime_favorites\" (\n \"id\" uuid NOT NULL PRIMARY KEY,\n \"anime_id\" integer NOT NULL NOT NULL,\n \"user_id\" integer NOT NULL NOT NULL,\n \"platform\" anime_platforms NOT NULL\n)\n" rows_affected=0 rows_returned=0 elapsed=1.254005ms elapsed_secs=0.001254005
2024-10-28T15:51:02.365496Z INFO Database startup: sqlx::query: summary="ALTER TABLE \"anime_favorites\" ADD β¦" db.statement="\n\nALTER TABLE\n \"anime_favorites\"\nADD\n CONSTRAINT \"fk_user\" FOREIGN KEY (\"user_id\") REFERENCES \"user_settings\" (\"id\") ON DELETE CASCADE ON UPDATE CASCADE\n" rows_affected=0 rows_returned=0 elapsed=2.315625ms elapsed_secs=0.002315625
2024-10-28T15:51:02.365556Z INFO Database startup: sea_orm_migration::migrator: Migration 'm20240829_223902_settings_anime_entity_and_relations' has been applied
2024-10-28T15:51:02.366374Z INFO Database startup: sqlx::query: summary="INSERT INTO \"seaql_migrations\" (\"version\", β¦" db.statement="\n\nINSERT INTO\n \"seaql_migrations\" (\"version\", \"applied_at\")\nVALUES\n ($1, $2)\nRETURNING\n \"version\"\n" rows_affected=1 rows_returned=1 elapsed=272.857Β΅s elapsed_secs=0.000272857
2024-10-28T15:51:02.366418Z INFO Database startup: sea_orm_migration::migrator: Applying migration 'm20241028_145603_player_queue'
2024-10-28T15:51:02.373262Z INFO Database startup: sqlx::query: summary="CREATE TABLE IF NOT β¦" db.statement="\n\nCREATE TABLE IF NOT EXISTS \"player_queue\" (\n \"id\" uuid NOT NULL PRIMARY KEY,\n \"created_at\" timestamp with time zone NOT NULL NOT NULL DEFAULT 'NOW()',\n \"updated_at\" timestamp with time zone NOT NULL NOT NULL DEFAULT 'NOW()',\n \"guild_id\" bigint NOT NULL,\n \"encoded\" varchar NOT NULL,\n \"is_seekable\" bool NOT NULL,\n \"author\" varchar NOT NULL,\n \"length\" integer NOT NULL,\n \"is_stream\" bool NOT NULL,\n \"title\" varchar NOT NULL,\n \"uri\" varchar NOT NULL,\n \"artwork_url\" varchar NOT NULL,\n \"isrc\" varchar NOT NULL,\n \"source_name\" varchar NOT NULL\n)\n" rows_affected=0 rows_returned=0 elapsed=1.969088ms elapsed_secs=0.001969088
2024-10-28T15:51:02.374301Z INFO Database startup: sqlx::query: summary="CREATE INDEX ON \"player_queue\" β¦" db.statement="\n\nCREATE INDEX ON \"player_queue\" (\"guild_id\")\n" rows_affected=0 rows_returned=0 elapsed=608.372Β΅s elapsed_secs=0.000608372
2024-10-28T15:51:02.375057Z INFO Database startup: sqlx::query: summary="CREATE INDEX ON \"player_queue\" β¦" db.statement="\n\nCREATE INDEX ON \"player_queue\" (\"uri\")\n" rows_affected=0 rows_returned=0 elapsed=455.412Β΅s elapsed_secs=0.000455412
2024-10-28T15:51:02.375099Z INFO Database startup: sea_orm_migration::migrator: Migration 'm20241028_145603_player_queue' has been applied
2024-10-28T15:51:02.375805Z INFO Database startup: sqlx::query: summary="INSERT INTO \"seaql_migrations\" (\"version\", β¦" db.statement="\n\nINSERT INTO\n \"seaql_migrations\" (\"version\", \"applied_at\")\nVALUES\n ($1, $2)\nRETURNING\n \"version\"\n" rows_affected=1 rows_returned=1 elapsed=172.316Β΅s elapsed_secs=0.000172316
2024-10-28T15:51:02.376486Z INFO Database startup: sqlx::query: summary="COMMIT" db.statement="" rows_affected=0 rows_returned=0 elapsed=621.357Β΅s elapsed_secs=0.000621357
2024-10-28T15:51:02.376544Z INFO Database startup: database: Migrations completed
Versions
cargo tree | grep sea-
β β βββ sea-orm v1.1.0
β β β βββ sea-orm-macros v1.1.0 (proc-macro)
β β β β βββ sea-bae v0.2.1 (proc-macro)
β β β βββ sea-query v0.32.0
β β β β βββ sea-query-derive v0.4.2 (proc-macro)
β β β βββ sea-query-binder v0.7.0
β β β β βββ sea-query v0.32.0 (*)
β β βββ sea-orm-migration v1.1.0
β β βββ sea-orm v1.1.0 (*)
β β βββ sea-orm-cli v1.1.0
β β β βββ sea-schema v0.16.0
β β β β βββ sea-query v0.32.0 (*)
β β β β βββ sea-schema-derive v0.3.0 (proc-macro)
β β βββ sea-schema v0.16.0 (*)
β βββ sea-orm v1.1.0 (*)
βββ sea-orm v1.1.0 (*)
Encountered the same issue