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
When I create tables in Postgres I typically add comments to the table and the columns in order to make it easier to identify what they are for.
Currently in Sea-Query it seems this is not supported in Postgres (but might be in MySQL) and I'd have to escape to raw SQL to do this.
Proposed Solutions
I think the most natural solution would be if the create_table method would in some way emit the statements required in Postgres to set the comments.
e.g:
manager
.create_table(Table::create().comment("Tracks classes of items. In the normal case you should expect to be able to search the items in the class parametrically.").table(ItemClass::Table).if_not_exists().col(ColumnDef::new(ItemClass::ClassPath).text().not_null().primary_key().comment("slash-separated path that represents the item class"),).col(ColumnDef::new(ItemClass::Description).text().not_null().default("").comment("markdown comment for the item class"),).to_owned(),).await?;
would emit
COMMENT ON TABLE item_class IS 'Tracks classes of items. In the normal case you should expect to be able to search the items in the class parametrically.';
COMMENT ON COLUMN item_class.class_path IS 'slash-separated path that represents the item class';
COMMENT ON COLUMN item_class.description IS 'markdown comment for the item class';
after the CREATE TABLE statement.
Especially since the Postgres syntax for this is awkward, it would make things a lot easier as well :-)
Additional Information
I think this syntax has been available in Postgres for more or less forever, so there should be no harm in supporting it.
The text was updated successfully, but these errors were encountered:
(as an aside, the equivalent in SQLite would be to emit SQL comments in the CREATE TABLE statement, since SQLite tracks the whole SQL text of the table creation. But I'm not sure how conventional it is for people to use that.)
Motivation
When I create tables in Postgres I typically add comments to the table and the columns in order to make it easier to identify what they are for.
Currently in Sea-Query it seems this is not supported in Postgres (but might be in MySQL) and I'd have to escape to raw SQL to do this.
Proposed Solutions
I think the most natural solution would be if the
create_table
method would in some way emit the statements required in Postgres to set the comments.e.g:
would emit
after the
CREATE TABLE
statement.Especially since the Postgres syntax for this is awkward, it would make things a lot easier as well :-)
Additional Information
I think this syntax has been available in Postgres for more or less forever, so there should be no harm in supporting it.
The text was updated successfully, but these errors were encountered: