mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-28 01:53:25 +00:00
create ReportRenderingOptions model
This commit is contained in:
6
app/models/report_rendering_options.rb
Normal file
6
app/models/report_rendering_options.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ReportRenderingOptions < ApplicationRecord
|
||||
belongs_to :user, class_name: "Spree::User"
|
||||
serialize :options, Hash
|
||||
end
|
||||
@@ -37,7 +37,7 @@ module Spree
|
||||
foreign_key: :owner_id, inverse_of: :owner
|
||||
has_many :customers
|
||||
has_many :credit_cards
|
||||
|
||||
has_many :report_rendering_options, class_name:"::ReportRenderingOptions",dependent: :destroy
|
||||
accepts_nested_attributes_for :enterprise_roles, allow_destroy: true
|
||||
|
||||
accepts_nested_attributes_for :bill_address
|
||||
|
||||
12
db/migrate/20221116095826_create_report_rendering_options.rb
Normal file
12
db/migrate/20221116095826_create_report_rendering_options.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
class CreateReportRenderingOptions < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :report_rendering_options do |t|
|
||||
t.references :user
|
||||
t.text :options
|
||||
t.string :report_type
|
||||
t.string :report_subtype
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
12
db/schema.rb
12
db/schema.rb
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2022_10_07_105052) do
|
||||
ActiveRecord::Schema.define(version: 2022_11_16_095826) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_stat_statements"
|
||||
@@ -354,6 +354,16 @@ ActiveRecord::Schema.define(version: 2022_10_07_105052) do
|
||||
t.index ["subscription_id"], name: "index_proxy_orders_on_subscription_id"
|
||||
end
|
||||
|
||||
create_table "report_rendering_options", force: :cascade do |t|
|
||||
t.bigint "user_id"
|
||||
t.text "options"
|
||||
t.string "report_type"
|
||||
t.string "report_subtype"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["user_id"], name: "index_report_rendering_options_on_user_id"
|
||||
end
|
||||
|
||||
create_table "schedules", id: :serial, force: :cascade do |t|
|
||||
t.string "name", limit: 255, null: false
|
||||
t.datetime "created_at", null: false
|
||||
|
||||
Reference in New Issue
Block a user