Merge branch 'dev_partners' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_partners
commit
260cc5b598
@ -0,0 +1,5 @@
|
|||||||
|
class Customer < ActiveRecord::Base
|
||||||
|
belongs_to :partner
|
||||||
|
has_one :scholl
|
||||||
|
has_many :users
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
class Partner < ActiveRecord::Base
|
||||||
|
attr_accessible :name
|
||||||
|
has_one :school
|
||||||
|
has_many :customers
|
||||||
|
end
|
@ -0,0 +1,9 @@
|
|||||||
|
class CreatePartners < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :partners do |t|
|
||||||
|
t.string :name
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,10 @@
|
|||||||
|
class CreateCustomers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :customers do |t|
|
||||||
|
t.references :partner
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
add_index :customers, :partner_id
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,8 @@
|
|||||||
|
class AddPartnerIdAndCustomerIdToSchools < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :schools, :partner_id, :integer
|
||||||
|
add_index :schools, :partner_id
|
||||||
|
add_column :schools, :customer_id, :integer
|
||||||
|
add_index :schools, :customer_id
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,6 @@
|
|||||||
|
class AddPartnerIdToUsers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :users, :partner_id, :integer
|
||||||
|
add_index :users, :partner_id
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in new issue