Note that there are some explanatory texts on larger screens.

plurals
  1. POCode First Migrations in SQL Azure - Tables without a clustered index are not supported
    primarykey
    data
    text
    <p>I can't seem to get my Code-First Migration to create my SQL Azure database.</p> <p>It keeps complaining about SQL Azure's lack of support for tables without clustered indexes and I cant find a way around to create my database.</p> <p><strong>Note:</strong> I'm using <code>CreateDatabaseIfNotExists</code> to create the change tracking tables on the first time database creation because apparently <code>DropCreateDatabaseIfModelChanges</code> <a href="https://stackoverflow.com/a/8630863/1267778">doesn't do that for you</a> </p> <pre><code> public partial class IUnityDbContext : DbContext { public IUnityDbContext() : base("Name=IUnityDbContext") { Database.SetInitializer(new CreateDatabaseIfNotExists&lt;IUnityDbContext&gt;()); //Database.SetInitializer(new DropCreateDatabaseIfModelChanges&lt;IUnityDbContext&gt;()); } public DbSet&lt;User&gt; 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 =&gt; new { ... } ).PrimaryKey(u =&gt; u.UserId, clustered: true); } public override void Down() { DropTable("dbo.Users"); } } </code></pre> <p>If I try to `Update-Database I get </p> <pre><code> Tables without a clustered index are not supported in this version of SQL Server. Please create a clustered index and try again. </code></pre> <p>The database is not created.</p> <p><strong>UPDATE:</strong> I started from scratch and followed <a href="http://geekswithblogs.net/michelotti/archive/2012/11/13/enable-automatic-code-first-migrations-on-sql-database-in-azure.aspx" rel="nofollow noreferrer">this guide</a> to enable Automatic Migrations (scratched the database and started with a non-existing one so I didn't have to remove the Up/Down code from the Initial migration)</p> <p>This time my database was successfully created (Did not get this far before) but the tables are not created and I still get the same error as before about no support for tables without clustered indexes.</p> <p>Please advise</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload