The configuration file is:
Code: Select all
public Configuration()
{
AutomaticMigrationsEnabled = false;
SetSqlGenerator(PgSqlConnectionInfo.InvariantName, new PgSqlEntityMigrationSqlGenerator());
var config = Devart.Data.PostgreSql.Entity.Configuration.PgSqlEntityProviderConfig.Instance;
config.CodeFirstOptions.AddTableNameInDefaultIndexName = true;
}
Code: Select all
CreateTable(
"dbo.Users",
c => new
{
id = c.Guid(nullable: false),
client_id = c.Guid(),
name = c.String(),
})
.PrimaryKey(t => t.id)
.ForeignKey("dbo.Clients", t => t.client_id)
.Index(t => t.id, name: "IX_Id")
.Index(t => t.client_id, name: "IX_Client_Id");
CreateTable(
"dbo.Scenes",
c => new
{
id = c.Guid(nullable: false),
client_id = c.Guid(),
name = c.String(maxLength: 450)
})
.PrimaryKey(t => t.id)
.ForeignKey("dbo.Clients", t => t.client_id)
.Index(t => t.id, name: "IX_Id")
.Index(t => t.client_id, name: "IX_Client_Id")
How could we make sure that indices are created unique automatically using the table name?