forked from concerto/concerto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlegacy_schema.rb
65 lines (56 loc) · 2 KB
/
legacy_schema.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
class V1User < ActiveRecord::Base
self.table_name = 'user'
establish_connection :legacy
end
class V1Group < ActiveRecord::Base
self.table_name = 'group'
has_and_belongs_to_many :users, class_name: 'V1User', join_table: 'user_group',
foreign_key: 'group_id', association_foreign_key: 'user_id'
establish_connection :legacy
end
class V1Feed < ActiveRecord::Base
self.table_name = 'feed'
self.inheritance_column = ''
belongs_to :group, class_name: 'V1Group', foreign_key: 'group_id'
establish_connection :legacy
end
class V1Type < ActiveRecord::Base
self.table_name = 'type'
establish_connection :legacy
end
class V1Content < ActiveRecord::Base
self.table_name = 'content'
self.inheritance_column = ''
belongs_to :user, class_name: 'V1User', foreign_key: 'user_id'
belongs_to :type, class_name: 'V1Type', foreign_key: 'type_id'
establish_connection :legacy
end
class V1Submission < ActiveRecord::Base
self.table_name = 'feed_content'
establish_connection :legacy
end
class V1Template < ActiveRecord::Base
self.table_name = 'template'
establish_connection :legacy
has_many :fields, class_name: 'V1Field', foreign_key: 'template_id'
end
class V1Field < ActiveRecord::Base
self.table_name = 'field'
belongs_to :template, class_name: 'V1Template', foreign_key: 'template_id'
belongs_to :type, class_name: 'V1Type', foreign_key: 'type_id'
establish_connection :legacy
end
class V1Screen < ActiveRecord::Base
self.table_name = 'screen'
self.inheritance_column = ''
establish_connection :legacy
belongs_to :template, class_name: 'V1Template', foreign_key: 'template_id'
has_many :subscriptions, class_name: 'V1Subscription', foreign_key: 'screen_id'
end
class V1Subscription < ActiveRecord::Base
self.table_name = 'position'
belongs_to :field, class_name: 'V1Field', foreign_key: 'field_id'
belongs_to :screen, class_name: 'V1Screen', foreign_key: 'screen_id'
belongs_to :feed, class_name: 'V1Feed', foreign_key: 'feed_id'
establish_connection :legacy
end