Class: CabooseStore::Schema

Inherits:
Caboose::Utilities::Schema
  • Object
show all
Defined in:
app/models/caboose_store/schema.rb

Class Method Summary collapse

Class Method Details

.load_dataObject



220
221
222
223
224
225
226
227
228
229
# File 'app/models/caboose_store/schema.rb', line 220

def self.load_data
  if !CabooseStore::Category.exists?(1)
    CabooseStore::Category.create({
      id: 1,
      name: 'All Products',
      url: '/products',
      slug: 'products'
    })
  end
end

.schemaObject



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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'app/models/caboose_store/schema.rb', line 4

def self.schema
  {  
    Caboose::User => [
       [ :is_guest , :boolean , { :default => false }]
    ],
    
    CabooseStore::Address => [
      [ :name          , :string  ],
      [ :first_name    , :string  ],
      [ :last_name     , :string  ],
      [ :street        , :string  ],
      [ :address1      , :string  ],
      [ :address2      , :string  ],
      [ :company       , :string  ],
      [ :city          , :string  ],
      [ :state         , :string  ],
      [ :province      , :string  ],
      [ :province_code , :string  ],
      [ :zip           , :string  ],
      [ :country       , :string  ],
      [ :country_code  , :string  ],
      [ :phone         , :string  ]
    ],
    
    CabooseStore::Category => [        
      [ :parent_id             , :integer   ],
      [ :name                  , :string    ],
      [ :url                   , :string    ],
      [ :slug                  , :string    ],
      [ :status                , :string    ],
      [ :image_file_name       , :string    ],
      [ :image_content_type    , :string    ],
      [ :image_file_size       , :integer   ],
      [ :image_updated_at      , :datetime  ],
      [ :square_offset_x       , :integer   ],
      [ :square_offset_y       , :integer   ],
      [ :square_scale_factor   , :numeric   ],
      [ :sort_order            , :integer   ]
    ],
    
    CabooseStore::CategoryMembership => [        
      [ :category_id           , :integer ],
      [ :product_id            , :integer ]      
    ],
    
    CabooseStore::Discount => [
      [ :name                  , :string   ],
      [ :code                  , :string   ],
      [ :amount_current        , :numeric  ],
      [ :amount_total          , :numeric  ],
      [ :amount_flat           , :numeric  ],
      [ :amount_percentage     , :numeric  ],
      [ :no_shipping           , :boolean  ],
      [ :no_tax                , :boolean  ]
    ],
    
    CabooseStore::OrderDiscount => [
      [ :order_id              , :integer ],
      [ :discount_id           , :integer ]
    ],
    
    CabooseStore::LineItem => [
      [ :order_id              , :integer  ],
      [ :variant_id            , :integer  ],
      [ :parent_id             , :integer  ],
      [ :quantity              , :integer   , :default => 0 ],
      [ :status                , :string   ],
      [ :tracking_number       , :string   ],
      #[ :unit_price            , :numeric  ],
      [ :price                 , :numeric   , :default => 0 ],
      [ :notes                 , :text     ],
      [ :custom1               , :string   ],
      [ :custom2               , :string   ],
      [ :custom3               , :string   ]
    ],
    
    CabooseStore::Order => [
      [ :email                 , :string   ],
      [ :order_number          , :string   ],
      [ :subtotal              , :numeric   , :default => 0 ],
      [ :tax                   , :numeric   , :default => 0 ],
      [ :shipping              , :numeric   , :default => 0 ],
      [ :handling              , :numeric   , :default => 0 ],
      [ :discount              , :numeric   , :default => 0 ],
      [ :total                 , :numeric   , :default => 0 ],
      [ :customer_id           , :integer  ],
      [ :payment_id            , :integer  ],
      [ :gateway_id            , :integer  ],
      [ :financial_status      , :string   ],
      [ :shipping_address_id   , :integer  ],
      [ :billing_address_id    , :integer  ],
      [ :notes                 , :text     ],
      [ :status                , :string   ],
      [ :date_created          , :datetime ],
      [ :date_authorized       , :datetime ],
      [ :date_captured         , :datetime ],
      [ :date_cancelled        , :datetime ],
      [ :referring_site        , :text     ],
      [ :landing_page          , :string   ],
      [ :landing_page_ref      , :string   ],
      [ :shipping_method       , :string   ],
      [ :shipping_method_code  , :string   ],
      [ :transaction_id        , :string   ],
      [ :auth_code             , :string   ],
      [ :alternate_id          , :integer  ],
      [ :auth_amount           , :numeric  ],
      [ :date_shipped          , :datetime ],
      [ :transaction_id        , :string   ],
      [ :transaction_service   , :string   ],
      [ :amount_discounted     , :numeric  ],
      [ :decremented           , :boolean  ]
    ],
    
    CabooseStore::ProductImage => [
      [ :product_id            , :integer  ],
      [ :title                 , :string   ],
      [ :position              , :integer  ],
      [ :image_file_name       , :string   ],
      [ :image_content_type    , :string   ],
      [ :image_file_size       , :integer  ],
      [ :image_updated_at      , :datetime ],
      [ :square_offset_x       , :integer  ],
      [ :square_offset_y       , :integer  ],
      [ :square_scale_factor   , :numeric  ]
    ],
    
    CabooseStore::ProductImageVariant => [
      [ :product_image_id      , :integer ],
      [ :variant_id            , :integer ]
    ],
    
    CabooseStore::Product => [
      [ :alternate_id          , :string    ],
      [ :title                 , :string    ],
      [ :caption               , :string    ],
      [ :description           , :text      ],
      [ :handle                , :string    ],
      [ :vendor_id             , :integer   ],
      [ :option1               , :string    ],
      [ :option2               , :string    ],
      [ :option3               , :string    ],
      [ :category_id           , :integer   ],
      [ :status                , :string    ],
      [ :default1              , :string    ],
      [ :default2              , :string    ],
      [ :default3              , :string    ],
      [ :seo_title             , :string    ],
      [ :seo_description       , :string    ],
      [ :alternate_id          , :string    ],
      [ :date_available        , :datetime  ],
      [ :custom_input          , :text      ],
      [ :sort_order            , :integer   ],
      [ :featured              , :boolean   , :default => false ]
    ],
    
    CabooseStore::Review => [
      [ :product_id            , :integer   ],
      [ :content               , :string    ],
      [ :name                  , :string    ],
      [ :rating                , :decimal   ] 
    ],      
    
    CabooseStore::SearchFilter => [
      [ :url                   , :string   ],
      [ :title_like            , :string   ],
      [ :search_like           , :string   ],
      [ :category_id           , :integer  ],
      [ :category              , :text     ],
      [ :vendors               , :text     ],
      [ :option1               , :text     ],
      [ :option2               , :text     ],
      [ :option3               , :text     ],        
      [ :prices                , :text     ] 
    ],
    
    CabooseStore::Variant => [
      [ :sku                   , :string   ],
      [ :barcode               , :string   ],
      [ :price                 , :numeric   , :default => 0 ],
      [ :available             , :boolean  ],
      #[ :quantity_in_stock     , :integer  ],
      [ :quantity              , :integer   , :default => 0 ],
      [ :ignore_quantity       , :boolean  ],
      [ :allow_backorder       , :boolean  ],
      [ :weight                , :decimal  ],
      [ :length                , :decimal  ],
      [ :width                 , :decimal  ],
      [ :height                , :decimal  ],
      [ :cylinder              , :boolean  ],
      [ :option1               , :string   ],
      [ :option2               , :string   ],
      [ :option3               , :string   ],
      [ :requires_shipping     , :boolean  ],
      [ :taxable               , :boolean  ],
      [ :product_id            , :integer  ],
      [ :shipping_unit_value   , :numeric  ],
      [ :alternate_id          , :string   ],
      [ :status                , :string   ],
      [ :option1_sort_order    , :integer  , { :defult => 0 }],
      [ :option2_sort_order    , :integer  , { :defult => 0 }],
      [ :option3_sort_order    , :integer  , { :defult => 0 }],
      [ :sort_order            , :integer  , { :defult => 0 }]
    ],
    
    CabooseStore::Vendor => [
      [ :name   , :string ],
      [ :status , :string, { default: 'Active' } ]
    ],
    
    CabooseStore::CustomizationMembership => [
      [ :product_id       , :integer ],
      [ :customization_id , :integer ]
    ]
  }
end