003_AddPersonTable.cs 633 B

123456789101112131415161718192021
  1. using Migrator.Framework;
  2. using System.Data;
  3. [Migration(3)]
  4. public class AddPersonTable : Migration
  5. {
  6. override public void Up()
  7. {
  8. Database.AddTable("Person",
  9. new Column("id", DbType.Int32, ColumnProperty.PrimaryKey),
  10. new Column("first_name", DbType.String, 50),
  11. new Column("last_name", DbType.String, 50),
  12. new Column("address_id", DbType.Int32, ColumnProperty.Unsigned)
  13. );
  14. Database.AddForeignKey("FK_PERSON_ADDRESS", "Person", "address_id", "Address", "id");
  15. }
  16. override public void Down()
  17. {
  18. Database.RemoveTable("Person");
  19. }
  20. }