wip multi orders
This commit is contained in:
parent
fd769509af
commit
f676497e43
29 changed files with 939 additions and 107 deletions
13
db/migrate/20250403102400_create_ordergroup_invoices.rb
Normal file
13
db/migrate/20250403102400_create_ordergroup_invoices.rb
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
class CreateOrdergroupInvoices < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
create_table :ordergroup_invoices do |t|
|
||||
t.date :invoice_date
|
||||
t.string :invoice_number
|
||||
t.string :payment_method
|
||||
t.boolean :paid, default: false
|
||||
t.boolean :sepa_downloaded, default: false
|
||||
t.string :sepa_sequence_type, default: "RCUR"
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
7
db/migrate/20250410090018_create_multi_orders.rb
Normal file
7
db/migrate/20250410090018_create_multi_orders.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
class CreateMultiOrders < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
create_table :multi_orders, id: :integer do |t|
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
5
db/migrate/20250410090902_add_multi_order_to_orders.rb
Normal file
5
db/migrate/20250410090902_add_multi_order_to_orders.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
class AddMultiOrderToOrders < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
add_reference :orders, :multi_order, foreign_key: true, type: :integer
|
||||
end
|
||||
end
|
||||
8
db/migrate/20250425093336_create_multi_group_orders.rb
Normal file
8
db/migrate/20250425093336_create_multi_group_orders.rb
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
class CreateMultiGroupOrders < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
create_table :multi_group_orders, id: :integer do |t|
|
||||
t.references :multi_order, null: false, foreign_key: true, type: :integer
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddMultiGroupOrderToGroupOrders < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
add_reference :group_orders, :multi_group_order, foreign_key: true, type: :integer
|
||||
end
|
||||
end
|
||||
16
db/migrate/20250430091541_add_ends_to_multi_order.rb
Normal file
16
db/migrate/20250430091541_add_ends_to_multi_order.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
class AddEndsToMultiOrder < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
add_column :multi_orders, :ends, :datetime
|
||||
|
||||
reversible do |dir|
|
||||
dir.up do
|
||||
MultiOrder.reset_column_information
|
||||
|
||||
MultiOrder.find_each do |multi_order|
|
||||
max_ends = multi_order.orders.maximum(:ends)
|
||||
multi_order.update_columns(ends: max_ends) if max_ends.present?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue