Sha256: db183a5ec8cd91555de27cbf55ec9bf3e8cb5320b8b01f87605a028b643f040a
Contents?: true
Size: 1.11 KB
Versions: 21
Compression:
Stored size: 1.11 KB
Contents
class RenameSiteToTeam < ActiveRecord::Migration[5.0] def change reversible do |dir| dir.up do remove_foreign_key :jobshop_users, column: "site_id" remove_foreign_key :jobshop_dashboards, column: "site_id" remove_foreign_key :jobshop_sites, column: "owner_id" end dir.down do add_foreign_key :jobshop_users, :jobshop_sites, column: "site_id", on_delete: :cascade add_foreign_key :jobshop_dashboards, :jobshop_sites, column: "site_id", on_delete: :cascade add_foreign_key :jobshop_sites, :jobshop_users, column: "owner_id", on_delete: :restrict end end rename_table :jobshop_sites, :jobshop_teams rename_column :jobshop_users, :site_id, :team_id rename_column :jobshop_dashboards, :site_id, :team_id add_foreign_key :jobshop_users, :jobshop_teams, column: "team_id", on_delete: :cascade add_foreign_key :jobshop_dashboards, :jobshop_teams, column: "team_id", on_delete: :cascade add_foreign_key :jobshop_teams, :jobshop_users, column: "owner_id", on_delete: :restrict end end
Version data entries
21 entries across 21 versions & 1 rubygems