Fluentmigrator: Handling tsvector for postgresql

Created on 25 Mar 2020  路  3Comments  路  Source: fluentmigrator/fluentmigrator

Hi, first of all, awesome project (I love it), thanks for all your efforts.

I have the following "issue" (?) and I couldn't find anything about it in the documentation. I have a postgresql db and I'm trying to create a migration for a table that has a column of type tsvector.

How would I go about adding that:

[Migration(202003251711)]
public class CreateExamplesTable : Migration {

    public override void Up() {
        Create.Table("examples")
            .WithColumn("id").AsInt64().PrimaryKey().Identity().NotNullable()
            .WithColumn("title").AsString(500).NotNullable()

            // other columns ...

            .WithColumn("test"); // <-- how do I specify tsvector ??
    }

    public override void Down() {
        Delete.Table("examples");
    }
}

In fact, how would I go about adding a db specific column type (for example JSON)? Is there a way to do that.

Any help would be much appreciated.

question question-answered

All 3 comments

Add .AsCustom("whateveruserdefinedtypeOrTypeNotKnownToFluentMigrator");

You can also look at the DBMA-specific extensions like SQL Server Extensions for inspiration on extending FluentMigrator using the Additional Data approach, but we're hoping to revamp that area in 4.0

Thanks a lot, not sure how I've missed that.

No worries. Feel free to contribute ideas to improve Postgres generator.

Was this page helpful?
0 / 5 - 0 ratings