1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-28 09:24:24 +01:00

fix migrations for rails 5 + use maildev instead of mailcatcher + fix tests script

This commit is contained in:
Sylvain 2020-03-24 16:45:27 +01:00
parent b3313d3e75
commit df8ff77597
272 changed files with 2108 additions and 1000 deletions

View File

@ -42,9 +42,6 @@ group :development do
gem 'web-console', '>= 3.3.0'
# Preview mail in the browser
gem 'listen', '~> 3.0.5'
# don't put mailcatcher into your Gemfile. It will conflict with your applications gems at some point.
# Instead, pop a note in your README stating you use mailcatcher, and to run gem install mailcatcher then mailcatcher to get started.
# gem 'mailcatcher'
gem 'rb-readline'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'railroady'

View File

@ -1,3 +1,3 @@
web: bundle exec rails server puma -p $PORT
worker: bundle exec sidekiq -C ./config/sidekiq.yml
mail: mailcatcher --foreground --http-ip=0.0.0.0
mail: node_modules/maildev/bin/maildev --ip 0.0.0.0

View File

@ -5,7 +5,7 @@ class Category < ActiveRecord::Base
has_many :events, dependent: :destroy
after_create :create_statistic_subtype
after_update :update_statistic_subtype, if: :name_changed?
after_update :update_statistic_subtype, if: :saved_change_to_name?
after_destroy :remove_statistic_subtype

View File

@ -11,7 +11,7 @@ class CustomAsset < ActiveRecord::Base
asset&.custom_asset_file&.attachment_url
end
after_update :update_stylesheet if :viewable_changed?
after_update :update_stylesheet if :saved_change_to_viewable?
def update_stylesheet
Stylesheet.theme.rebuild! if %w[profile-image-file].include? name

View File

@ -19,8 +19,8 @@ class Group < ActiveRecord::Base
after_create :create_prices
after_create :create_statistic_subtype
after_update :update_statistic_subtype, if: :name_changed?
after_update :disable_plans, if: :disabled_changed?
after_update :update_statistic_subtype, if: :saved_change_to_name?
after_update :disable_plans, if: :saved_change_to_disabled?
def destroyable?
users.empty? and plans.empty?

View File

@ -29,7 +29,7 @@ class Machine < ActiveRecord::Base
after_create :create_statistic_subtype
after_create :create_machine_prices
after_update :update_statistic_subtype, if: :name_changed?
after_update :update_statistic_subtype, if: :saved_change_to_name?
after_destroy :remove_statistic_subtype
def not_subscribe_price(group_id)

View File

@ -37,7 +37,7 @@ class Profile < ActiveRecord::Base
private
def invoicing_data_was_modified?
first_name_changed? or last_name_changed? or new_record?
saved_change_to_first_name? || saved_change_to_last_name? || new_record?
end
def update_invoicing_profile

View File

@ -149,7 +149,7 @@ class Project < ActiveRecord::Base
end
def after_save_and_publish
return unless state_changed? && published?
return unless saved_change_to_state? && published?
update_columns(published_at: DateTime.current)
notify_admin_when_project_published

View File

@ -6,7 +6,7 @@ class ProjectUser < ActiveRecord::Base
before_create :generate_valid_token
after_commit :notify_project_collaborator_to_valid, on: :create
after_update :notify_project_author_when_collaborator_valid, if: :is_valid_changed?
after_update :notify_project_author_when_collaborator_valid, if: :saved_change_to_is_valid?
private
def generate_valid_token

View File

@ -53,11 +53,11 @@ class Slot < ActiveRecord::Base
end
def dates_were_modified?
start_at_changed? or end_at_changed?
saved_change_to_start_at? || saved_change_to_end_at?
end
def canceled?
canceled_at_changed?
saved_change_to_canceled_at?
end
def set_ex_start_end_dates_attrs

View File

@ -21,7 +21,7 @@ class Space < ActiveRecord::Base
after_create :create_statistic_subtype
after_create :create_space_prices
after_update :update_statistic_subtype, if: :name_changed?
after_update :update_statistic_subtype, if: :saved_change_to_name?
after_destroy :remove_statistic_subtype

View File

@ -23,7 +23,7 @@ class Training < ActiveRecord::Base
after_create :create_statistic_subtype
after_create :create_trainings_pricings
after_update :update_statistic_subtype, if: :name_changed?
after_update :update_statistic_subtype, if: :saved_change_to_name?
after_destroy :remove_statistic_subtype
def amount_by_group(group)

View File

@ -54,7 +54,7 @@ class User < ActiveRecord::Base
after_commit :create_stripe_customer, on: [:create]
after_commit :notify_admin_when_user_is_created, on: :create
after_create :init_dependencies
after_update :notify_group_changed, if: :group_id_changed?
after_update :notify_group_changed, if: :saved_change_to_group_id?
after_update :update_invoicing_profile, if: :invoicing_data_was_modified?
after_update :update_statistic_profile, if: :statistic_data_was_modified?
before_destroy :remove_orphan_drafts
@ -354,11 +354,11 @@ class User < ActiveRecord::Base
end
def invoicing_data_was_modified?
email_changed?
saved_change_to_email?
end
def statistic_data_was_modified?
group_id_changed?
saved_change_to_group_id?
end
def init_dependencies

View File

@ -5,6 +5,6 @@ class StylesheetSweeper < ActionController::Caching::Sweeper
observe Stylesheet
def after_update(record)
expire_page(controller: 'stylesheets', action: 'show', id: record.id) if record.contents_changed?
expire_page(controller: 'stylesheets', action: 'show', id: record.id) if record.saved_change_to_contents?
end
end

View File

@ -8,9 +8,6 @@
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# DEPRECATION WARNING: raise_on_unfiltered_parameters is deprecated and has no effect in Rails 5.1.
Rails.application.config.action_controller.raise_on_unfiltered_parameters = true
# Enable per-form CSRF tokens. Previous versions had false.
Rails.application.config.action_controller.per_form_csrf_tokens = false
@ -23,7 +20,3 @@ ActiveSupport.to_time_preserves_timezone = false
# Require `belongs_to` associations by default. Previous versions had false.
Rails.application.config.active_record.belongs_to_required_by_default = false
# DEPRECATION WARNING: ActiveSupport.halt_callback_chains_on_return_false= is deprecated and will be removed in Rails 5.2.
# Do not halt callback chains when a callback returns false. Previous versions had true.
ActiveSupport.halt_callback_chains_on_return_false = true

View File

@ -1,9 +1,12 @@
class DeviseCreateUsers < ActiveRecord::Migration
# frozen_string_literal: true
# create the Users table, storing the user's accounts
class DeviseCreateUsers < ActiveRecord::Migration[4.2]
def change
create_table(:users) do |t|
## Database authenticatable
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
t.string :email, null: false, default: ''
t.string :encrypted_password, null: false, default: ''
## Recoverable
t.string :reset_password_token

View File

@ -1,19 +1,21 @@
class RolifyCreateRoles < ActiveRecord::Migration
# frozen_string_literal:true
class RolifyCreateRoles < ActiveRecord::Migration[4.2]
def change
create_table(:roles) do |t|
t.string :name
t.references :resource, :polymorphic => true
t.references :resource, polymorphic: true
t.timestamps
end
create_table(:users_roles, :id => false) do |t|
create_table(:users_roles, id: false) do |t|
t.references :user
t.references :role
end
add_index(:roles, :name)
add_index(:roles, [ :name, :resource_type, :resource_id ])
add_index(:users_roles, [ :user_id, :role_id ])
add_index(:roles, %i[name resource_type resource_id])
add_index(:users_roles, %i[user_id role_id])
end
end

View File

@ -1,4 +1,6 @@
class CreateProfiles < ActiveRecord::Migration
# frozen_string_literal:true
class CreateProfiles < ActiveRecord::Migration[4.2]
def change
create_table :profiles do |t|
t.belongs_to :user, index: true

View File

@ -1,4 +1,6 @@
class CreateProjects < ActiveRecord::Migration
# frozen_string_literal:true
class CreateProjects < ActiveRecord::Migration[4.2]
def change
create_table :projects do |t|
t.string :name

View File

@ -1,4 +1,6 @@
class CreateMachines < ActiveRecord::Migration
# frozen_string_literal:true
class CreateMachines < ActiveRecord::Migration[4.2]
def change
create_table :machines do |t|
t.string :name, null: false

View File

@ -1,4 +1,6 @@
class CreateAssets < ActiveRecord::Migration
# frozen_string_literal:true
class CreateAssets < ActiveRecord::Migration[4.2]
def change
create_table :assets do |t|
t.references :viewable, polymorphic: true

View File

@ -1,4 +1,6 @@
class CreateProjectsMachines < ActiveRecord::Migration
# frozen_string_literal:true
class CreateProjectsMachines < ActiveRecord::Migration[4.2]
def change
create_table :projects_machines do |t|
t.belongs_to :project, index: true

View File

@ -1,4 +1,6 @@
class AddIsAllowContactToUser < ActiveRecord::Migration
# frozen_string_literal:true
class AddIsAllowContactToUser < ActiveRecord::Migration[4.2]
def change
add_column :users, :is_allow_contact, :boolean, default: true
end

View File

@ -1,4 +1,6 @@
class CreateProjectUser < ActiveRecord::Migration
# frozen_string_literal:true
class CreateProjectUser < ActiveRecord::Migration[4.2]
def change
create_table :project_users do |t|
t.belongs_to :project, index: true

View File

@ -1,4 +1,6 @@
class AddAuthorIdToProject < ActiveRecord::Migration
# frozen_string_literal:true
class AddAuthorIdToProject < ActiveRecord::Migration[4.2]
def change
add_column :projects, :author_id, :integer
end

View File

@ -1,4 +1,6 @@
class CreateProjectSteps < ActiveRecord::Migration
# frozen_string_literal:true
class CreateProjectSteps < ActiveRecord::Migration[4.2]
def change
create_table :project_steps do |t|
t.text :description

View File

@ -1,4 +1,6 @@
class CreateAvailabilities < ActiveRecord::Migration
# frozen_string_literal:true
class CreateAvailabilities < ActiveRecord::Migration[4.2]
def change
create_table :availabilities do |t|
t.datetime :start_at

View File

@ -1,4 +1,6 @@
class CreateMachinesAvailabilities < ActiveRecord::Migration
# frozen_string_literal:true
class CreateMachinesAvailabilities < ActiveRecord::Migration[4.2]
def change
create_table :machines_availabilities do |t|
t.belongs_to :machine, index: true

View File

@ -1,4 +1,6 @@
class AddTitleToProjectStep < ActiveRecord::Migration
# frozen_string_literal:true
class AddTitleToProjectStep < ActiveRecord::Migration[4.2]
def change
add_column :project_steps, :title, :string
remove_column :project_steps, :picture, :string

View File

@ -1,4 +1,6 @@
class CreateReservations < ActiveRecord::Migration
# frozen_string_literal:true
class CreateReservations < ActiveRecord::Migration[4.2]
def change
create_table :reservations do |t|
t.belongs_to :user, index: true

View File

@ -1,4 +1,6 @@
class CreateSlots < ActiveRecord::Migration
# frozen_string_literal:true
class CreateSlots < ActiveRecord::Migration[4.2]
def change
create_table :slots do |t|
t.datetime :start_at

View File

@ -1,4 +1,6 @@
class AddReservableToReservation < ActiveRecord::Migration
# frozen_string_literal:true
class AddReservableToReservation < ActiveRecord::Migration[4.2]
def change
add_reference :reservations, :reservable, index: true, polymorphic: true
end

View File

@ -1,4 +1,6 @@
class CreateAddresses < ActiveRecord::Migration
# frozen_string_literal:true
class CreateAddresses < ActiveRecord::Migration[4.2]
def change
create_table :addresses do |t|
t.string :address

View File

@ -1,4 +1,6 @@
class CreateComponents < ActiveRecord::Migration
# frozen_string_literal:true
class CreateComponents < ActiveRecord::Migration[4.2]
def change
create_table :components do |t|
t.string :name, null: false

View File

@ -1,4 +1,6 @@
class CreateThemes < ActiveRecord::Migration
# frozen_string_literal:true
class CreateThemes < ActiveRecord::Migration[4.2]
def change
create_table :themes do |t|
t.string :name, null: false

View File

@ -1,4 +1,6 @@
class CreateLicences < ActiveRecord::Migration
# frozen_string_literal:true
class CreateLicences < ActiveRecord::Migration[4.2]
def change
create_table :licences do |t|
t.string :name, null: false

View File

@ -1,4 +1,6 @@
class CreateProjectsComponents < ActiveRecord::Migration
# frozen_string_literal:true
class CreateProjectsComponents < ActiveRecord::Migration[4.2]
def change
create_table :projects_components do |t|
t.belongs_to :project, index: true

View File

@ -1,4 +1,6 @@
class CreateProjectsThemes < ActiveRecord::Migration
# frozen_string_literal:true
class CreateProjectsThemes < ActiveRecord::Migration[4.2]
def change
create_table :projects_themes do |t|
t.belongs_to :project, index: true

View File

@ -1,4 +1,6 @@
class AddTagsToProject < ActiveRecord::Migration
# frozen_string_literal:true
class AddTagsToProject < ActiveRecord::Migration[4.2]
def change
add_column :projects, :tags, :text
end

View File

@ -1,4 +1,6 @@
class AddLicenceIdToProject < ActiveRecord::Migration
# frozen_string_literal:true
class AddLicenceIdToProject < ActiveRecord::Migration[4.2]
def change
add_column :projects, :licence_id, :integer
end

View File

@ -1,4 +1,6 @@
class AddStateToProject < ActiveRecord::Migration
# frozen_string_literal:true
class AddStateToProject < ActiveRecord::Migration[4.2]
def change
add_column :projects, :state, :string
Project.all.each do |p|

View File

@ -1,4 +1,6 @@
class CreateNotifications < ActiveRecord::Migration
# frozen_string_literal:true
class CreateNotifications < ActiveRecord::Migration[4.2]
def change
create_table :notifications do |t|
t.integer :receiver_id

View File

@ -1,4 +1,6 @@
class AddIsValidToProjectUser < ActiveRecord::Migration
# frozen_string_literal:true
class AddIsValidToProjectUser < ActiveRecord::Migration[4.2]
def change
add_column :project_users, :is_valid, :boolean, default: false
end

View File

@ -1,4 +1,6 @@
class AddValidTokenToProjectUser < ActiveRecord::Migration
# frozen_string_literal:true
class AddValidTokenToProjectUser < ActiveRecord::Migration[4.2]
def change
add_column :project_users, :valid_token, :string
end

View File

@ -1,4 +1,6 @@
class CreateUserTrainings < ActiveRecord::Migration
# frozen_string_literal:true
class CreateUserTrainings < ActiveRecord::Migration[4.2]
def change
create_table :user_trainings do |t|
t.belongs_to :user, index: true

View File

@ -1,4 +1,6 @@
class CreateGroups < ActiveRecord::Migration
# frozen_string_literal:true
class CreateGroups < ActiveRecord::Migration[4.2]
def change
create_table :groups do |t|
t.string :name

View File

@ -1,4 +1,6 @@
class CreatePlans < ActiveRecord::Migration
# frozen_string_literal:true
class CreatePlans < ActiveRecord::Migration[4.2]
def change
create_table :plans do |t|
t.string :name

View File

@ -1,4 +1,6 @@
class CreateTrainingsPricings < ActiveRecord::Migration
# frozen_string_literal:true
class CreateTrainingsPricings < ActiveRecord::Migration[4.2]
def change
create_table :trainings_pricings do |t|
t.belongs_to :machine, index: true

View File

@ -1,4 +1,6 @@
class AddGroupToUser < ActiveRecord::Migration
# frozen_string_literal:true
class AddGroupToUser < ActiveRecord::Migration[4.2]
def change
add_reference :users, :group, index: true
end

View File

@ -1,4 +1,6 @@
class CreateTrainings < ActiveRecord::Migration
# frozen_string_literal:true
class CreateTrainings < ActiveRecord::Migration[4.2]
def change
create_table :trainings do |t|
t.string :name

View File

@ -1,4 +1,6 @@
class CreateTrainingsMachine < ActiveRecord::Migration
# frozen_string_literal:true
class CreateTrainingsMachine < ActiveRecord::Migration[4.2]
def change
create_table :trainings_machines do |t|
t.belongs_to :training, index: true

View File

@ -1,4 +1,6 @@
class CreateTrainingsAvailabilities < ActiveRecord::Migration
# frozen_string_literal:true
class CreateTrainingsAvailabilities < ActiveRecord::Migration[4.2]
def change
create_table :trainings_availabilities do |t|
t.belongs_to :training, index: true

View File

@ -1,4 +1,6 @@
class AddAvailabilityIdToReservation < ActiveRecord::Migration
# frozen_string_literal:true
class AddAvailabilityIdToReservation < ActiveRecord::Migration[4.2]
def change
add_column :reservations, :availability_id, :integer
add_index :reservations, :availability_id

View File

@ -1,4 +1,6 @@
class ChangeMachineIdToTrainingIdFromUserTraining < ActiveRecord::Migration
# frozen_string_literal:true
class ChangeMachineIdToTrainingIdFromUserTraining < ActiveRecord::Migration[4.2]
def change
remove_belongs_to :user_trainings, :machine, index: true
add_belongs_to :user_trainings, :training, index: true

View File

@ -1,4 +1,6 @@
class ChangeMachineToTrainingFromTrainingsPricing < ActiveRecord::Migration
# frozen_string_literal:true
class ChangeMachineToTrainingFromTrainingsPricing < ActiveRecord::Migration[4.2]
def change
remove_belongs_to :trainings_pricings, :machine, index: true
add_belongs_to :trainings_pricings, :training, index: true

View File

@ -1,4 +1,6 @@
class RemoveAvailabilityIdFormReservations < ActiveRecord::Migration
# frozen_string_literal:true
class RemoveAvailabilityIdFormReservations < ActiveRecord::Migration[4.2]
def change
remove_column :reservations, :availability_id, :integer
end

View File

@ -1,4 +1,6 @@
class AddAvailabilityToSlot < ActiveRecord::Migration
# frozen_string_literal:true
class AddAvailabilityToSlot < ActiveRecord::Migration[4.2]
def change
add_reference :slots, :availability, index: true
end

View File

@ -1,4 +1,6 @@
class AddStpCustomerIdToUsers < ActiveRecord::Migration
# frozen_string_literal:true
class AddStpCustomerIdToUsers < ActiveRecord::Migration[4.2]
def up
add_column :users, :stp_customer_id, :string
User.all.each do |user|

View File

@ -1,4 +1,6 @@
class CreateSubscriptions < ActiveRecord::Migration
# frozen_string_literal:true
class CreateSubscriptions < ActiveRecord::Migration[4.2]
def change
create_table :subscriptions do |t|
t.belongs_to :plan, index: true

View File

@ -1,4 +1,6 @@
class AddStpInvoiceIdToReservation < ActiveRecord::Migration
# frozen_string_literal:true
class AddStpInvoiceIdToReservation < ActiveRecord::Migration[4.2]
def change
add_column :reservations, :stp_invoice_id, :string
add_index :reservations, :stp_invoice_id

View File

@ -1,4 +1,6 @@
class AddStartAtToSubscription < ActiveRecord::Migration
# frozen_string_literal:true
class AddStartAtToSubscription < ActiveRecord::Migration[4.2]
def change
add_column :subscriptions, :start_at, :datetime
Subscription.all.each do |s|

View File

@ -1,4 +1,6 @@
class CreateFriendlyIdSlugs < ActiveRecord::Migration
# frozen_string_literal:true
class CreateFriendlyIdSlugs < ActiveRecord::Migration[4.2]
def change
create_table :friendly_id_slugs do |t|
t.string :slug, :null => false

View File

@ -1,4 +1,6 @@
class AddSlugToProjects < ActiveRecord::Migration
# frozen_string_literal:true
class AddSlugToProjects < ActiveRecord::Migration[4.2]
def change
add_column :projects, :slug, :string
add_index :projects, :slug, unique: true

View File

@ -1,4 +1,6 @@
class AddStripIdToGroups < ActiveRecord::Migration
# frozen_string_literal:true
class AddStripIdToGroups < ActiveRecord::Migration[4.2]
def change
add_column :groups, :stripe_id, :string
end

View File

@ -1,4 +1,6 @@
class AddSlugToMachines < ActiveRecord::Migration
# frozen_string_literal:true
class AddSlugToMachines < ActiveRecord::Migration[4.2]
def change
add_column :machines, :slug, :string
add_index :machines, :slug, unique: true

View File

@ -1,4 +1,6 @@
class CreateCredits < ActiveRecord::Migration
# frozen_string_literal:true
class CreateCredits < ActiveRecord::Migration[4.2]
def change
create_table :credits do |t|
t.references :creditable, polymorphic: true

View File

@ -1,4 +1,6 @@
class CreateUsersCredits < ActiveRecord::Migration
# frozen_string_literal:true
class CreateUsersCredits < ActiveRecord::Migration[4.2]
def change
create_table :users_credits do |t|
t.belongs_to :user, index: true

View File

@ -1,4 +1,6 @@
class AddTrainingCreditNbToPlan < ActiveRecord::Migration
# frozen_string_literal:true
class AddTrainingCreditNbToPlan < ActiveRecord::Migration[4.2]
def change
add_column :plans, :training_credit_nb, :integer

View File

@ -1,4 +1,6 @@
class ChangeStartAtToExpiredAtFromSubscription < ActiveRecord::Migration
# frozen_string_literal:true
class ChangeStartAtToExpiredAtFromSubscription < ActiveRecord::Migration[4.2]
def change
remove_column :subscriptions, :start_at, :datetime
add_column :subscriptions, :expired_at, :datetime

View File

@ -1,4 +1,6 @@
class AddUsernameToUser < ActiveRecord::Migration
# frozen_string_literal:true
class AddUsernameToUser < ActiveRecord::Migration[4.2]
def change
add_column :users, :username, :string, after: :id

View File

@ -1,4 +1,6 @@
class AddIndexUsernameToUser < ActiveRecord::Migration
# frozen_string_literal:true
class AddIndexUsernameToUser < ActiveRecord::Migration[4.2]
def change
add_index :users, :username, unique: true
end

View File

@ -1,4 +1,6 @@
class RemoveUsernameFromProfiles < ActiveRecord::Migration
# frozen_string_literal:true
class RemoveUsernameFromProfiles < ActiveRecord::Migration[4.2]
def change
remove_column :profiles, :username, :string
end

View File

@ -1,4 +1,6 @@
class AddSlugToUsers < ActiveRecord::Migration
# frozen_string_literal:true
class AddSlugToUsers < ActiveRecord::Migration[4.2]
def change
add_column :users, :slug, :string
add_index :users, :slug, unique: true

View File

@ -1,4 +1,6 @@
class CreateEvents < ActiveRecord::Migration
# frozen_string_literal:true
class CreateEvents < ActiveRecord::Migration[4.2]
def change
create_table :events do |t|
t.string :title

View File

@ -1,4 +1,6 @@
class CreateCategories < ActiveRecord::Migration
# frozen_string_literal:true
class CreateCategories < ActiveRecord::Migration[4.2]
def change
create_table :categories do |t|
t.string :name

View File

@ -1,4 +1,6 @@
class CreateEventsCategories < ActiveRecord::Migration
# frozen_string_literal:true
class CreateEventsCategories < ActiveRecord::Migration[4.2]
def change
create_table :events_categories do |t|
t.belongs_to :event, index: true

View File

@ -1,4 +1,6 @@
class ChangeEvent < ActiveRecord::Migration
# frozen_string_literal:true
class ChangeEvent < ActiveRecord::Migration[4.2]
def change
add_column :events, :availability_id, :integer
add_index :events, :availability_id

View File

@ -1,4 +1,6 @@
class AddNbReservePlacesAndNbReserveReducedPlacesToReservation < ActiveRecord::Migration
# frozen_string_literal:true
class AddNbReservePlacesAndNbReserveReducedPlacesToReservation < ActiveRecord::Migration[4.2]
def change
add_column :reservations, :nb_reserve_places, :integer
add_column :reservations, :nb_reserve_reduced_places, :integer

View File

@ -1,4 +1,6 @@
class AddRecurrenceIdToEvent < ActiveRecord::Migration
# frozen_string_literal:true
class AddRecurrenceIdToEvent < ActiveRecord::Migration[4.2]
def change
add_column :events, :recurrence_id, :integer
add_index :events, :recurrence_id

View File

@ -1,4 +1,6 @@
class CreateInvoices < ActiveRecord::Migration
# frozen_string_literal:true
class CreateInvoices < ActiveRecord::Migration[4.2]
def change
create_table :invoices do |t|
t.references :invoiced, polymorphic: true

View File

@ -1,4 +1,6 @@
class CreateInvoiceItems < ActiveRecord::Migration
# frozen_string_literal:true
class CreateInvoiceItems < ActiveRecord::Migration[4.2]
def change
create_table :invoice_items do |t|
t.text :description

View File

@ -1,4 +1,6 @@
class AddUserIdToInvoice < ActiveRecord::Migration
# frozen_string_literal:true
class AddUserIdToInvoice < ActiveRecord::Migration[4.2]
def change
add_reference :invoices, :user, index: true
end

View File

@ -1,4 +1,6 @@
class RemoveDescriptionFromInvoiceItems < ActiveRecord::Migration
# frozen_string_literal:true
class RemoveDescriptionFromInvoiceItems < ActiveRecord::Migration[4.2]
def change
remove_column :invoice_items, :description, :string
end

View File

@ -1,4 +1,6 @@
class AddInvoicedToInvoiceItems < ActiveRecord::Migration
# frozen_string_literal:true
class AddInvoicedToInvoiceItems < ActiveRecord::Migration[4.2]
def change
add_column :invoice_items, :invoiced_id, :integer
add_column :invoice_items, :invoiced_type, :string

View File

@ -1,4 +1,6 @@
class RemoveInvoicedFromInvoiceItems < ActiveRecord::Migration
# frozen_string_literal:true
class RemoveInvoicedFromInvoiceItems < ActiveRecord::Migration[4.2]
def change
remove_column :invoice_items, :invoiced_id, :integer
remove_column :invoice_items, :invoiced_type, :string

View File

@ -1,4 +1,6 @@
class AddDescriptionToInvoiceItems < ActiveRecord::Migration
# frozen_string_literal:true
class AddDescriptionToInvoiceItems < ActiveRecord::Migration[4.2]
def change
add_column :invoice_items, :description, :text
end

View File

@ -1,4 +1,6 @@
class AddSubscriptionIdToInvoiceItems < ActiveRecord::Migration
# frozen_string_literal:true
class AddSubscriptionIdToInvoiceItems < ActiveRecord::Migration[4.2]
def change
add_column :invoice_items, :subscription_id, :integer
end

View File

@ -1,4 +1,6 @@
class AddReferenceToInvoice < ActiveRecord::Migration
# frozen_string_literal:true
class AddReferenceToInvoice < ActiveRecord::Migration[4.2]
def change
add_column :invoices, :reference, :string
end

View File

@ -1,4 +1,6 @@
class AddCanceledAtToSubscription < ActiveRecord::Migration
# frozen_string_literal:true
class AddCanceledAtToSubscription < ActiveRecord::Migration[4.2]
def change
add_column :subscriptions, :canceled_at, :datetime
end

View File

@ -1,4 +1,6 @@
class AddToCancelToSubscription < ActiveRecord::Migration
# frozen_string_literal:true
class AddToCancelToSubscription < ActiveRecord::Migration[4.2]
def change
add_column :subscriptions, :to_cancel, :boolean, default: true
end

View File

@ -1,4 +1,6 @@
class RemoveToCancelFromSubscription < ActiveRecord::Migration
# frozen_string_literal:true
class RemoveToCancelFromSubscription < ActiveRecord::Migration[4.2]
def change
remove_column :subscriptions, :to_cancel, :string
end

View File

@ -1,4 +1,6 @@
class CreateOfferDays < ActiveRecord::Migration
# frozen_string_literal:true
class CreateOfferDays < ActiveRecord::Migration[4.2]
def change
create_table :offer_days do |t|
t.belongs_to :subscription, index: true

View File

@ -1,4 +1,6 @@
class AddNbTotalPlacesToTrainings < ActiveRecord::Migration
# frozen_string_literal:true
class AddNbTotalPlacesToTrainings < ActiveRecord::Migration[4.2]
def change
add_column :trainings, :nb_total_places, :integer
end

View File

@ -1,4 +1,6 @@
class AddNbTotalPlacesToAvailability < ActiveRecord::Migration
# frozen_string_literal:true
class AddNbTotalPlacesToAvailability < ActiveRecord::Migration[4.2]
def change
add_column :availabilities, :nb_total_places, :integer
end

View File

@ -1,4 +1,6 @@
class AddSlugToTrainings < ActiveRecord::Migration
# frozen_string_literal:true
class AddSlugToTrainings < ActiveRecord::Migration[4.2]
def up
add_column :trainings, :slug, :string
add_index :trainings, :slug, unique: true

View File

@ -1,4 +1,6 @@
class AddPublishedAtToProjects < ActiveRecord::Migration
# frozen_string_literal:true
class AddPublishedAtToProjects < ActiveRecord::Migration[4.2]
def up
add_column :projects, :published_at, :datetime

View File

@ -1,4 +1,6 @@
class CreateStatisticIndices < ActiveRecord::Migration
# frozen_string_literal:true
class CreateStatisticIndices < ActiveRecord::Migration[4.2]
def change
create_table :statistic_indices do |t|
t.string :es_type_key

View File

@ -1,4 +1,6 @@
class CreateStatisticTypes < ActiveRecord::Migration
# frozen_string_literal:true
class CreateStatisticTypes < ActiveRecord::Migration[4.2]
def change
create_table :statistic_types do |t|
t.belongs_to :statistic_index, index: true

View File

@ -1,4 +1,6 @@
class CreateStatisticSubTypes < ActiveRecord::Migration
# frozen_string_literal:true
class CreateStatisticSubTypes < ActiveRecord::Migration[4.2]
def change
create_table :statistic_sub_types do |t|
t.belongs_to :statistic_type, index: true

View File

@ -1,4 +1,6 @@
class AddSimpleToStatisticSubType < ActiveRecord::Migration
# frozen_string_literal:true
class AddSimpleToStatisticSubType < ActiveRecord::Migration[4.2]
def change
add_column :statistic_sub_types, :simple, :boolean
end

Some files were not shown because too many files have changed in this diff Show More