Search code examples
c#postgresqlfluent-migrator

How to create a PostgreSQL table with column of type array using Fluentmigrator in C#


I might be overlooking something simple, I'm pretty novice with Fluentmigrator, but is it possible to create a table, using Fluentmigrator in C# code, that has a column of type array such as TEXT []?

Here is an example using SQL Syntax for comparison of the goal, with the column 'arrt' as the target column to create:

CREATE TEMPORARY TABLE IF NOT EXISTS array_test (
    id SERIAL, 
    is_active BOOLEAN,
    arrt TEXT[]
);

I tried checking the list of available methods through Visual Studio intelli-sense, on the WithColumn() method but this isn't giving me any luck. Also, although I am not sure I looked in the right place I did try going through the list of types here, which didn't show any indications I could tell that it is supported.


Solution

  • This worked for me:

    Create.Table("tablename")
                    .WithColumn("columnname").AsCustom("TEXT[]").Nullable();