You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
999B

  1. <%
  2. '=======================================================================================================================
  3. ' MIGRATION: create_areas_tables
  4. ' Areas (cities, regions...) a business covers. A business can cover several areas, so the link is its own table.
  5. '=======================================================================================================================
  6. Sub Migration_Up(migration)
  7. migration.CreateTable "areas", "id AUTOINCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL"
  8. migration.ExecuteSQL "CREATE UNIQUE INDEX uq_areas_name ON areas (name)"
  9. migration.CreateTable "business_areas", "business_id LONG NOT NULL, area_id LONG NOT NULL"
  10. migration.ExecuteSQL "CREATE UNIQUE INDEX uq_business_areas ON business_areas (business_id, area_id)"
  11. migration.CreateIndex "ix_business_areas_area_id", "business_areas", "area_id"
  12. End Sub
  13. Sub Migration_Down(migration)
  14. migration.DropTable "business_areas"
  15. migration.DropTable "areas"
  16. End Sub
  17. %>

Powered by TurnKey Linux.