This needs to be done in two steps.
First you need to force WebMatrix to not create the tables. There is a parameter to the InitializeDatabase methode for that
As for creating the table. Since they aren't part of your EF model they won't be created by the Enable-Migrations.
You will need to add the table creation to your initial migration. Scripts are available on that anwser
public partial class AddWebMatrixSecurityTables: DbMigration
{
public override void Up()
{
Sql(@"Create ...");
}
public override void Down()
{
Sql("Drop....");
}
}
If you prefer to use the Fluent API to build the tables, you can use this code. You will have to modify it to include your UserProfile table with FK to both webpages_Membership and webpages_UsersInRoles
using System;
using System.Data.Entity.Migrations;
public partial class AddWebMatrixTables : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.webpages_Membership",
c => new
{
UserId = c.Int(nullable: false, identity: true),
CreateDate = c.DateTime(nullable: true),
ConfirmationToken = c.String(nullable: true, maxLength: 128),
IsConfirmed = c.Boolean(nullable: true, defaultValue: false),
LastPasswordFailureDate = c.DateTime(nullable: true),
PasswordFailuresSinceLastSuccess = c.Int(nullable: false, defaultValue: 0),
Password = c.String(nullable: false, maxLength: 128),
PasswordChangedDate = c.DateTime(nullable: true),
PasswordSalt = c.String(nullable: false, maxLength: 128),
PasswordVerificationToken = c.String(nullable: true, maxLength: 128),
PasswordVerificationTokenExpirationDate = c.DateTime(nullable: true)
})
.PrimaryKey(t => t.UserId);
CreateTable(
"dbo.webpages_OAuthMembership",
c => new
{
Provider = c.String(nullable: false, maxLength: 30),
ProviderUserId = c.String(nullable: false, maxLength: 100),
UserId = c.Int(nullable: false)
})
.PrimaryKey(t => new {t.Provider, t.ProviderUserId});
CreateTable(
"dbo.webpages_Roles",
c => new
{
RoleId = c.Int(nullable: false, identity: true),
RoleName = c.String(nullable: false, maxLength: 256)
})
.PrimaryKey(t => t.RoleId);
CreateTable(
"dbo.webpages_UsersInRoles",
c => new
{
UserId = c.Int(nullable: false),
RoleId = c.Int(nullable: false)
})
.PrimaryKey(t => new {t.UserId, t.RoleId})
.ForeignKey("dbo.webpages_Roles", t => t.RoleId);
}
public override void Down()
{
DropForeignKey("dbo.webpages_UsersInRoles", "RoleId", "dbo.webpages_Roles");
DropForeignKey("dbo.webpages_UsersInRoles", "UserId", "dbo.webpages_Membership");
DropTable("dbo.webpages_UsersInRoles");
DropTable("dbo.webpages_Roles");
DropTable("dbo.webpages_OAuthMembership");
DropTable("dbo.webpages_Membership");
}
}