I can't seem to get my first copy of the code to create an Azure SQL database.
He continues to complain about the lack of SQL Azure support for tables without clustered indexes, and I cannot find a way to create my database.
Note. . I use CreateDatabaseIfNotExiststo create change tracking tables when creating the first database because it DropCreateDatabaseIfModelChanges doesn’t seem to do this for you
public partial class IUnityDbContext : DbContext
{
public IUnityDbContext()
: base("Name=IUnityDbContext")
{
Database.SetInitializer(new CreateDatabaseIfNotExists<IUnityDbContext>());
}
public DbSet<User> Users { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Configurations.Add(new UserMap());
base.OnModelCreating(modelBuilder);
}
}
public partial class Initial : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.Users",
c => new {
...
}
).PrimaryKey(u => u.UserId, clustered: true);
}
public override void Down()
{
DropTable("dbo.Users");
}
}
If I try to update the database, I get
Tables without a clustered index are not supported in this version of SQL Server. Please create a clustered index and try again.
The database is not created.
: , ( , Up/Down )
( ), , - , , .