From 9b801f0a85d75b409ed39c4107a5101f04181d9e Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Mon, 30 May 2016 23:43:56 +0200 Subject: [PATCH] domain migration --- db/migrate/20160530173603_create_domains.rb | 13 +++++++++++++ db/migrate/20160530173749_create_domain_needs.rb | 12 ++++++++++++ .../20160530173923_create_domain_customers.rb | 12 ++++++++++++ .../20160530213935_create_domain_need_categories.rb | 12 ++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 db/migrate/20160530173603_create_domains.rb create mode 100644 db/migrate/20160530173749_create_domain_needs.rb create mode 100644 db/migrate/20160530173923_create_domain_customers.rb create mode 100644 db/migrate/20160530213935_create_domain_need_categories.rb diff --git a/db/migrate/20160530173603_create_domains.rb b/db/migrate/20160530173603_create_domains.rb new file mode 100644 index 0000000..947169c --- /dev/null +++ b/db/migrate/20160530173603_create_domains.rb @@ -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 diff --git a/db/migrate/20160530173749_create_domain_needs.rb b/db/migrate/20160530173749_create_domain_needs.rb new file mode 100644 index 0000000..35d9f2d --- /dev/null +++ b/db/migrate/20160530173749_create_domain_needs.rb @@ -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 diff --git a/db/migrate/20160530173923_create_domain_customers.rb b/db/migrate/20160530173923_create_domain_customers.rb new file mode 100644 index 0000000..67bd48a --- /dev/null +++ b/db/migrate/20160530173923_create_domain_customers.rb @@ -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 diff --git a/db/migrate/20160530213935_create_domain_need_categories.rb b/db/migrate/20160530213935_create_domain_need_categories.rb new file mode 100644 index 0000000..6346d9a --- /dev/null +++ b/db/migrate/20160530213935_create_domain_need_categories.rb @@ -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