domain migration

This commit is contained in:
Nicolas Bally 2016-05-30 23:43:56 +02:00
parent 1c5eaa373d
commit 9b801f0a85
4 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,13 @@
class CreateDomains < ActiveRecord::Migration
def change
create_table :domains do |t|
t.string :name
t.string :slug
t.boolean :superadmin
t.boolean :enabled
t.text :description
t.timestamps null: false
end
end
end

View File

@ -0,0 +1,12 @@
class CreateDomainNeeds < ActiveRecord::Migration
def change
create_table :domain_needs do |t|
t.references :domain, index: true
t.references :need, index: true
t.timestamps null: false
end
add_foreign_key :domain_needs, :domains
add_foreign_key :domain_needs, :needs
end
end

View File

@ -0,0 +1,12 @@
class CreateDomainCustomers < ActiveRecord::Migration
def change
create_table :domain_customers do |t|
t.references :domain, index: true
t.references :customer, index: true
t.timestamps null: false
end
add_foreign_key :domain_customers, :domains
add_foreign_key :domain_customers, :customers
end
end

View File

@ -0,0 +1,12 @@
class CreateDomainNeedCategories < ActiveRecord::Migration
def change
create_table :domain_need_categories do |t|
t.references :domain, index: true
t.references :need_category, index: true
t.timestamps null: false
end
add_foreign_key :domain_need_categories, :domains
add_foreign_key :domain_need_categories, :need_categories
end
end