diff --git a/CHANGELOG.md b/CHANGELOG.md index d0322400d..4578c5808 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Fix some security issues: updated sidekiq to 5.2.7 to fix XSS and CRSF issues - Removed dependency to jQuery UI - Updated angular-xeditable, to remove dependency to jquery 1.11.1 +- [TODO DEPLOY] -> (only dev) `bundle install` - [TODO DEPLOY] `rake db:migrate` ## v4.0.2 2019 July 10 diff --git a/Procfile b/Procfile index f8a9f7b3c..fe0aeffa3 100644 --- a/Procfile +++ b/Procfile @@ -1,3 +1,3 @@ web: bundle exec rails server puma -p $PORT -b0.0.0.0 -worker: bundle exec sidekiq -C ./config/sidekiq.yml +#worker: bundle exec sidekiq -C ./config/sidekiq.yml mail: bundle exec mailcatcher --foreground diff --git a/app/services/accounting_export_service.rb b/app/services/accounting_export_service.rb index 8089920bd..0fa727e59 100644 --- a/app/services/accounting_export_service.rb +++ b/app/services/accounting_export_service.rb @@ -8,190 +8,219 @@ class AccountingExportService @encoding = encoding @format = format @separator = separator - @journal_code = Setting.find_by(name: 'accounting-export_journal-code')&.value + @journal_code = Setting.find_by(name: 'accounting-export_journal-code')&.value || '' @date_format = date_format @columns = columns - @vat_rate = Setting.find_by(name: 'invoice_VAT-rate')&.value&.to_f + @vat_rate = Setting.find_by(name: 'invoice_VAT-rate')&.value&.to_f || 0 end def export(start_date, end_date, file) # build CVS content - content = '' + content = header_row invoices = Invoice.where('created_at >= ? AND created_at <= ?', start_date, end_date).order('created_at ASC') invoices.each do |i| - content += generate_rows(i) + content << generate_rows(i) end # write content to file - File.open(file, "w:#{encoding}+b") { |f| f.puts content } + File.open(file, "w:#{encoding}") { |f| f.puts content.encode(encoding, invalid: :replace, undef: :replace) } end private + def header_row + row = '' + columns.each do |column| + row << I18n.t("accounting_export.#{column}") << separator + end + row + end + def generate_rows(invoice) - client_row(invoice) + "\n" + - items_rows(invoice) + "\n" + - vat_row(invoice) + "\n" + "#{client_row(invoice)}\n" \ + "#{items_rows(invoice)}\n" \ + "#{vat_row(invoice)}\n" end # Generate the "subscription" and "reservation" rows associated with the provided invoice def items_rows(invoice) - rows = invoice.subscription_invoice? ? subscription_row(invoice) + "\n" : '' - invoice.invoice_items.each do |item| - rows += reservation_row(invoice, item) + "\n" + rows = invoice.subscription_invoice? ? "#{subscription_row(invoice)}\n" : '' + if invoice.invoiced_type == 'Reservation' + invoice.invoice_items.each do |item| + rows << "#{reservation_row(invoice, item)}\n" + end end + rows end # Generate the "client" row, which contains the debit to the client account, all taxes included def client_row(invoice) + total = invoice.total / 100.0 row = '' columns.each do |column| case column when 'journal_code' - row += journal_code + row << journal_code when 'date' - row += invoice.created_at&.strftime(date_format) + row << invoice.created_at&.strftime(date_format) when 'account_code' - row += account(invoice, :client) + row << account(invoice, :client) when 'account_label' - row += account(invoice, :client, :label) + row << account(invoice, :client, :label) when 'piece' - row += invoice.reference + row << invoice.reference when 'line_label' - row += invoice.invoicing_profile.full_name + row << invoice.invoicing_profile.full_name when 'debit_origin' - row += debit_client(invoice, invoice.total / 100.0) + row << debit_client(invoice, total) when 'credit_origin' - row += credit_client(invoice, invoice.total / 100.0) + row << credit_client(invoice, total) when 'debit_euro' - row += debit_client(invoice, invoice.total / 100.0) + row << debit_client(invoice, total) when 'credit_euro' - row += credit_client(invoice, invoice.total / 100.0) + row << credit_client(invoice, total) + when 'lettering' + row << '' else puts "Unsupported column: #{column}" end - row += separator + row << separator end + row end # Generate the "reservation" row, which contains the credit to the reservation account, all taxes excluded def reservation_row(invoice, item) - wo_taxes = item.amount / (vat_rate / 100 + 1) + wo_taxes = (item.amount / (vat_rate / 100 + 1)) / 100.0 row = '' columns.each do |column| case column when 'journal_code' - row += journal_code + row << journal_code when 'date' - row += invoice.created_at&.strftime(date_format) + row << invoice.created_at&.strftime(date_format) when 'account_code' - row += account(invoice, :reservation) + row << account(invoice, :reservation) when 'account_label' - row += account(invoice, :reservation, :label) + row << account(invoice, :reservation, :label) when 'piece' - row += invoice.reference + row << invoice.reference when 'line_label' - row += item.description + row << item.description when 'debit_origin' - row += debit(invoice, wo_taxes) + row << debit(invoice, wo_taxes) when 'credit_origin' - row += credit(invoice, wo_taxes) + row << credit(invoice, wo_taxes) when 'debit_euro' - row += debit(invoice, wo_taxes) + row << debit(invoice, wo_taxes) when 'credit_euro' - row += credit(invoice, wo_taxes) + row << credit(invoice, wo_taxes) + when 'lettering' + row << '' else puts "Unsupported column: #{column}" end - row += separator + row << separator end + row end # Generate the "subscription" row, which contains the credit to the subscription account, all taxes excluded def subscription_row(invoice) subscription_item = invoice.invoice_items.select(&:subscription).first - wo_taxes = subscription_item.amount / (vat_rate / 100 + 1) + wo_taxes = (subscription_item.amount / (vat_rate / 100 + 1)) / 100.0 row = '' columns.each do |column| case column when 'journal_code' - row += journal_code + row << journal_code when 'date' - row += invoice.created_at&.strftime(date_format) + row << invoice.created_at&.strftime(date_format) when 'account_code' - row += account(invoice, :subscription) + row << account(invoice, :subscription) when 'account_label' - row += account(invoice, :subscription, :label) + row << account(invoice, :subscription, :label) when 'piece' - row += invoice.reference + row << invoice.reference when 'line_label' - row += subscription_item.description + row << subscription_item.description when 'debit_origin' - row += debit(invoice, wo_taxes) + row << debit(invoice, wo_taxes) when 'credit_origin' - row += credit(invoice, wo_taxes) + row << credit(invoice, wo_taxes) when 'debit_euro' - row += debit(invoice, wo_taxes) + row << debit(invoice, wo_taxes) when 'credit_euro' - row += credit(invoice, wo_taxes) + row << credit(invoice, wo_taxes) + when 'lettering' + row << '' else puts "Unsupported column: #{column}" end - row += separator + row << separator end + row end # Generate the "VAT" row, which contains the credit to the VAT account, with VAT amount only def vat_row(invoice) - vat = invoice.total - (invoice.total / (vat_rate / 100 + 1)) + vat = (invoice.total - (invoice.total / (vat_rate / 100 + 1))) / 100.0 row = '' columns.each do |column| case column when 'journal_code' - row += journal_code + row << journal_code when 'date' - row += invoice.created_at&.strftime(date_format) + row << invoice.created_at&.strftime(date_format) when 'account_code' - row += account(invoice, :vat) + row << account(invoice, :vat) when 'account_label' - row += account(invoice, :vat, :label) + row << account(invoice, :vat, :label) when 'piece' - row += invoice.reference + row << invoice.reference when 'line_label' - row += I18n.t('accounting_export.VAT') + row << I18n.t('accounting_export.VAT') when 'debit_origin' - row += debit(invoice, vat) + row << debit(invoice, vat) when 'credit_origin' - row += credit(invoice, vat) + row << credit(invoice, vat) when 'debit_euro' - row += debit(invoice, vat) + row << debit(invoice, vat) when 'credit_euro' - row += credit(invoice, vat) + row << credit(invoice, vat) + when 'lettering' + row << '' else puts "Unsupported column: #{column}" end - row += separator + row << separator end + row end # Get the account code (or label) for the given invoice and the specified line type (client, vat, subscription or reservation) def account(invoice, account, type = :code) - case account - when :client - Setting.find_by(name: "accounting_client_#{type}")&.value || '' - when :vat - Setting.find_by(name: "accounting_VAT_#{type}")&.value || '' - when :subscription - return if invoice.invoiced_type != 'Subscription' - - Setting.find_by(name: "accounting_subscription_#{type}")&.value || '' - when :reservation - return if invoice.invoiced_type != 'Reservation' - - Setting.find_by(name: "accounting_#{invoice.invoiced.reservable_type}_#{type}")&.value || '' - else - puts "Unsupported account #{account}" - end + res = case account + when :client + Setting.find_by(name: "accounting_client_#{type}")&.value + when :vat + Setting.find_by(name: "accounting_VAT_#{type}")&.value + when :subscription + if invoice.subscription_invoice? + Setting.find_by(name: "accounting_subscription_#{type}")&.value + else + puts "WARN: Invoice #{invoice.id} has no subscription" + end + when :reservation + if invoice.invoiced_type == 'Reservation' + Setting.find_by(name: "accounting_#{invoice.invoiced.reservable_type}_#{type}")&.value + else + puts "WARN: Invoice #{invoice.id} has no reservation" + end + else + puts "Unsupported account #{account}" + end + res || '' end # Fill the value of the "debit" column: if the invoice is a refund, returns the given amount, returns 0 otherwise diff --git a/config/locales/en.yml b/config/locales/en.yml index 7f585140f..271ac62f8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -127,6 +127,17 @@ en: and: 'and' accounting_export: + journal_code: "Journal code" + date: "Entry date" + account_code: "Account code" + account_label: "Account label" + piece: "Document" + line_label: "Entry label" + debit_origin: "Origin debit" + credit_origin: "Origin credit" + debit_euro: "Euro debit" + credit_euro: "Euro credit" + lettering: "Lettering" VAT: 'VAT' trainings: diff --git a/config/locales/es.yml b/config/locales/es.yml index acd3968da..16a6df8ea 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -127,6 +127,17 @@ es: and: 'y' accounting_export: + journal_code: "Journal code" # translation_missing + date: "Entry date" # translation_missing + account_code: "Account code" # translation_missing + account_label: "Account label" # translation_missing + piece: "Document" # translation_missing + line_label: "Entry label" # translation_missing + debit_origin: "Origin debit" # translation_missing + credit_origin: "Origin credit" # translation_missing + debit_euro: "Euro debit" # translation_missing + credit_euro: "Euro credit" # translation_missing + lettering: "Lettering" # translation_missing VAT: 'IVA' trainings: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index c7c017ddc..c10f50ca2 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -127,6 +127,17 @@ fr: and: 'et' accounting_export: + journal_code: "Code journal" + date: "Date écriture" + account_code: "Code compte" + account_label: "Intitulé compte" + piece: "Pièce" + line_label: "Libellé écriture" + debit_origin: "Débit origine" + credit_origin: "Crédit origine" + debit_euro: "Débit euro" + credit_euro: "Crédit euro" + lettering: "Lettrage" VAT: 'TVA' trainings: diff --git a/config/locales/pt.yml b/config/locales/pt.yml index 87bebdee2..bfe86650b 100755 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -127,6 +127,17 @@ pt: and: 'e' accounting_export: + journal_code: "Journal code" # translation_missing + date: "Entry date" # translation_missing + account_code: "Account code" # translation_missing + account_label: "Account label" # translation_missing + piece: "Document" # translation_missing + line_label: "Entry label" # translation_missing + debit_origin: "Origin debit" # translation_missing + credit_origin: "Origin credit" # translation_missing + debit_euro: "Euro debit" # translation_missing + credit_euro: "Euro credit" # translation_missing + lettering: "Lettering" # translation_missing VAT: 'IVA' trainings: diff --git a/db/schema.rb b/db/schema.rb index 227076c17..05cc94851 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -44,14 +44,14 @@ ActiveRecord::Schema.define(version: 20190730085826) do end create_table "addresses", force: :cascade do |t| - t.string "address" - t.string "street_number" - t.string "route" - t.string "locality" - t.string "country" - t.string "postal_code" + t.string "address", limit: 255 + t.string "street_number", limit: 255 + t.string "route", limit: 255 + t.string "locality", limit: 255 + t.string "country", limit: 255 + t.string "postal_code", limit: 255 t.integer "placeable_id" - t.string "placeable_type" + t.string "placeable_type", limit: 255 t.datetime "created_at" t.datetime "updated_at" end @@ -67,9 +67,9 @@ ActiveRecord::Schema.define(version: 20190730085826) do create_table "assets", force: :cascade do |t| t.integer "viewable_id" - t.string "viewable_type" - t.string "attachment" - t.string "type" + t.string "viewable_type", limit: 255 + t.string "attachment", limit: 255 + t.string "type", limit: 255 t.datetime "created_at" t.datetime "updated_at" end @@ -86,12 +86,12 @@ ActiveRecord::Schema.define(version: 20190730085826) do create_table "availabilities", force: :cascade do |t| t.datetime "start_at" t.datetime "end_at" - t.string "available_type" + t.string "available_type", limit: 255 t.datetime "created_at" t.datetime "updated_at" t.integer "nb_total_places" - t.boolean "destroying", default: false - t.boolean "lock", default: false + t.boolean "destroying", default: false + t.boolean "lock", default: false end create_table "availability_tags", force: :cascade do |t| @@ -105,7 +105,7 @@ ActiveRecord::Schema.define(version: 20190730085826) do add_index "availability_tags", ["tag_id"], name: "index_availability_tags_on_tag_id", using: :btree create_table "categories", force: :cascade do |t| - t.string "name" + t.string "name", limit: 255 t.datetime "created_at" t.datetime "updated_at" t.string "slug" @@ -114,7 +114,7 @@ ActiveRecord::Schema.define(version: 20190730085826) do add_index "categories", ["slug"], name: "index_categories_on_slug", unique: true, using: :btree create_table "components", force: :cascade do |t| - t.string "name", null: false + t.string "name", limit: 255, null: false end create_table "coupons", force: :cascade do |t| @@ -132,7 +132,7 @@ ActiveRecord::Schema.define(version: 20190730085826) do create_table "credits", force: :cascade do |t| t.integer "creditable_id" - t.string "creditable_type" + t.string "creditable_type", limit: 255 t.integer "plan_id" t.integer "hours" t.datetime "created_at" @@ -173,7 +173,7 @@ ActiveRecord::Schema.define(version: 20190730085826) do add_index "event_themes", ["slug"], name: "index_event_themes_on_slug", unique: true, using: :btree create_table "events", force: :cascade do |t| - t.string "title" + t.string "title", limit: 255 t.text "description" t.datetime "created_at" t.datetime "updated_at" @@ -212,10 +212,10 @@ ActiveRecord::Schema.define(version: 20190730085826) do add_index "exports", ["user_id"], name: "index_exports_on_user_id", using: :btree create_table "friendly_id_slugs", force: :cascade do |t| - t.string "slug", null: false - t.integer "sluggable_id", null: false + t.string "slug", limit: 255, null: false + t.integer "sluggable_id", null: false t.string "sluggable_type", limit: 50 - t.string "scope" + t.string "scope", limit: 255 t.datetime "created_at" end @@ -225,10 +225,10 @@ ActiveRecord::Schema.define(version: 20190730085826) do add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree create_table "groups", force: :cascade do |t| - t.string "name" + t.string "name", limit: 255 t.datetime "created_at" t.datetime "updated_at" - t.string "slug" + t.string "slug", limit: 255 t.boolean "disabled" end @@ -248,7 +248,7 @@ ActiveRecord::Schema.define(version: 20190730085826) do create_table "invoice_items", force: :cascade do |t| t.integer "invoice_id" - t.string "stp_invoice_item_id" + t.string "stp_invoice_item_id", limit: 255 t.integer "amount" t.datetime "created_at" t.datetime "updated_at" @@ -262,16 +262,16 @@ ActiveRecord::Schema.define(version: 20190730085826) do create_table "invoices", force: :cascade do |t| t.integer "invoiced_id" - t.string "invoiced_type" - t.string "stp_invoice_id" + t.string "invoiced_type", limit: 255 + t.string "stp_invoice_id", limit: 255 t.integer "total" t.datetime "created_at" t.datetime "updated_at" - t.string "reference" - t.string "avoir_mode" + t.string "reference", limit: 255 + t.string "avoir_mode", limit: 255 t.datetime "avoir_date" t.integer "invoice_id" - t.string "type" + t.string "type", limit: 255 t.boolean "subscription_to_expire" t.text "description" t.integer "wallet_amount" @@ -302,17 +302,17 @@ ActiveRecord::Schema.define(version: 20190730085826) do add_index "invoicing_profiles", ["user_id"], name: "index_invoicing_profiles_on_user_id", using: :btree create_table "licences", force: :cascade do |t| - t.string "name", null: false + t.string "name", limit: 255, null: false t.text "description" end create_table "machines", force: :cascade do |t| - t.string "name", null: false + t.string "name", limit: 255, null: false t.text "description" t.text "spec" t.datetime "created_at" t.datetime "updated_at" - t.string "slug" + t.string "slug", limit: 255 t.boolean "disabled" end @@ -329,14 +329,14 @@ ActiveRecord::Schema.define(version: 20190730085826) do create_table "notifications", force: :cascade do |t| t.integer "receiver_id" t.integer "attached_object_id" - t.string "attached_object_type" + t.string "attached_object_type", limit: 255 t.integer "notification_type_id" - t.boolean "is_read", default: false + t.boolean "is_read", default: false t.datetime "created_at" t.datetime "updated_at" t.string "receiver_type" - t.boolean "is_send", default: false - t.jsonb "meta_data", default: {} + t.boolean "is_send", default: false + t.jsonb "meta_data", default: {} end add_index "notifications", ["notification_type_id"], name: "index_notifications_on_notification_type_id", using: :btree @@ -405,20 +405,20 @@ ActiveRecord::Schema.define(version: 20190730085826) do add_index "organizations", ["invoicing_profile_id"], name: "index_organizations_on_invoicing_profile_id", using: :btree create_table "plans", force: :cascade do |t| - t.string "name" + t.string "name", limit: 255 t.integer "amount" - t.string "interval" + t.string "interval", limit: 255 t.integer "group_id" - t.string "stp_plan_id" + t.string "stp_plan_id", limit: 255 t.datetime "created_at" t.datetime "updated_at" - t.integer "training_credit_nb", default: 0 - t.boolean "is_rolling", default: true + t.integer "training_credit_nb", default: 0 + t.boolean "is_rolling", default: true t.text "description" t.string "type" t.string "base_name" - t.integer "ui_weight", default: 0 - t.integer "interval_count", default: 1 + t.integer "ui_weight", default: 0 + t.integer "interval_count", default: 1 t.string "slug" t.boolean "disabled" end @@ -448,9 +448,9 @@ ActiveRecord::Schema.define(version: 20190730085826) do create_table "profiles", force: :cascade do |t| t.integer "user_id" - t.string "first_name" - t.string "last_name" - t.string "phone" + t.string "first_name", limit: 255 + t.string "last_name", limit: 255 + t.string "phone", limit: 255 t.text "interest" t.text "software_mastered" t.datetime "created_at" @@ -480,7 +480,7 @@ ActiveRecord::Schema.define(version: 20190730085826) do t.integer "project_id" t.datetime "created_at" t.datetime "updated_at" - t.string "title" + t.string "title", limit: 255 t.integer "step_nb" end @@ -491,27 +491,27 @@ ActiveRecord::Schema.define(version: 20190730085826) do t.integer "user_id" t.datetime "created_at" t.datetime "updated_at" - t.boolean "is_valid", default: false - t.string "valid_token" + t.boolean "is_valid", default: false + t.string "valid_token", limit: 255 end add_index "project_users", ["project_id"], name: "index_project_users_on_project_id", using: :btree add_index "project_users", ["user_id"], name: "index_project_users_on_user_id", using: :btree create_table "projects", force: :cascade do |t| - t.string "name" + t.string "name", limit: 255 t.text "description" t.datetime "created_at" t.datetime "updated_at" t.text "tags" t.integer "licence_id" - t.string "state" - t.string "slug" + t.string "state", limit: 255 + t.string "slug", limit: 255 t.datetime "published_at" t.integer "author_statistic_profile_id" end - add_index "projects", ["slug"], name: "index_projects_on_slug", unique: true, using: :btree + add_index "projects", ["slug"], name: "index_projects_on_slug", using: :btree create_table "projects_components", force: :cascade do |t| t.integer "project_id" @@ -550,20 +550,20 @@ ActiveRecord::Schema.define(version: 20190730085826) do t.datetime "created_at" t.datetime "updated_at" t.integer "reservable_id" - t.string "reservable_type" - t.string "stp_invoice_id" + t.string "reservable_type", limit: 255 + t.string "stp_invoice_id", limit: 255 t.integer "nb_reserve_places" t.integer "statistic_profile_id" end - add_index "reservations", ["reservable_type", "reservable_id"], name: "index_reservations_on_reservable_type_and_reservable_id", using: :btree + add_index "reservations", ["reservable_id", "reservable_type"], name: "index_reservations_on_reservable_id_and_reservable_type", using: :btree add_index "reservations", ["statistic_profile_id"], name: "index_reservations_on_statistic_profile_id", using: :btree add_index "reservations", ["stp_invoice_id"], name: "index_reservations_on_stp_invoice_id", using: :btree create_table "roles", force: :cascade do |t| - t.string "name" + t.string "name", limit: 255 t.integer "resource_id" - t.string "resource_type" + t.string "resource_type", limit: 255 t.datetime "created_at" t.datetime "updated_at" end @@ -637,18 +637,18 @@ ActiveRecord::Schema.define(version: 20190730085826) do create_table "statistic_fields", force: :cascade do |t| t.integer "statistic_index_id" - t.string "key" - t.string "label" + t.string "key", limit: 255 + t.string "label", limit: 255 t.datetime "created_at" t.datetime "updated_at" - t.string "data_type" + t.string "data_type", limit: 255 end add_index "statistic_fields", ["statistic_index_id"], name: "index_statistic_fields_on_statistic_index_id", using: :btree create_table "statistic_graphs", force: :cascade do |t| t.integer "statistic_index_id" - t.string "chart_type" + t.string "chart_type", limit: 255 t.integer "limit" t.datetime "created_at" t.datetime "updated_at" @@ -657,12 +657,12 @@ ActiveRecord::Schema.define(version: 20190730085826) do add_index "statistic_graphs", ["statistic_index_id"], name: "index_statistic_graphs_on_statistic_index_id", using: :btree create_table "statistic_indices", force: :cascade do |t| - t.string "es_type_key" - t.string "label" + t.string "es_type_key", limit: 255 + t.string "label", limit: 255 t.datetime "created_at" t.datetime "updated_at" - t.boolean "table", default: true - t.boolean "ca", default: true + t.boolean "table", default: true + t.boolean "ca", default: true end create_table "statistic_profile_trainings", force: :cascade do |t| @@ -690,8 +690,8 @@ ActiveRecord::Schema.define(version: 20190730085826) do add_index "statistic_profiles", ["user_id"], name: "index_statistic_profiles_on_user_id", using: :btree create_table "statistic_sub_types", force: :cascade do |t| - t.string "key" - t.string "label" + t.string "key", limit: 255 + t.string "label", limit: 255 t.datetime "created_at" t.datetime "updated_at" end @@ -708,8 +708,8 @@ ActiveRecord::Schema.define(version: 20190730085826) do create_table "statistic_types", force: :cascade do |t| t.integer "statistic_index_id" - t.string "key" - t.string "label" + t.string "key", limit: 255 + t.string "label", limit: 255 t.boolean "graph" t.datetime "created_at" t.datetime "updated_at" @@ -726,7 +726,7 @@ ActiveRecord::Schema.define(version: 20190730085826) do create_table "subscriptions", force: :cascade do |t| t.integer "plan_id" - t.string "stp_subscription_id" + t.string "stp_subscription_id", limit: 255 t.datetime "created_at" t.datetime "updated_at" t.datetime "expiration_date" @@ -746,7 +746,7 @@ ActiveRecord::Schema.define(version: 20190730085826) do add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree create_table "themes", force: :cascade do |t| - t.string "name", null: false + t.string "name", limit: 255, null: false end create_table "tickets", force: :cascade do |t| @@ -761,13 +761,13 @@ ActiveRecord::Schema.define(version: 20190730085826) do add_index "tickets", ["reservation_id"], name: "index_tickets_on_reservation_id", using: :btree create_table "trainings", force: :cascade do |t| - t.string "name" + t.string "name", limit: 255 t.datetime "created_at" t.datetime "updated_at" t.integer "nb_total_places" - t.string "slug" + t.string "slug", limit: 255 t.text "description" - t.boolean "public_page", default: true + t.boolean "public_page", default: true t.boolean "disabled" end @@ -813,31 +813,31 @@ ActiveRecord::Schema.define(version: 20190730085826) do add_index "user_tags", ["user_id"], name: "index_user_tags_on_user_id", using: :btree create_table "users", force: :cascade do |t| - t.string "email", default: "", null: false - t.string "encrypted_password", default: "", null: false - t.string "reset_password_token" + t.string "email", limit: 255, default: "", null: false + t.string "encrypted_password", limit: 255, default: "", null: false + t.string "reset_password_token", limit: 255 t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0, null: false + t.integer "sign_in_count", default: 0, null: false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" - t.string "current_sign_in_ip" - t.string "last_sign_in_ip" - t.string "confirmation_token" + t.string "current_sign_in_ip", limit: 255 + t.string "last_sign_in_ip", limit: 255 + t.string "confirmation_token", limit: 255 t.datetime "confirmed_at" t.datetime "confirmation_sent_at" - t.string "unconfirmed_email" - t.integer "failed_attempts", default: 0, null: false - t.string "unlock_token" + t.string "unconfirmed_email", limit: 255 + t.integer "failed_attempts", default: 0, null: false + t.string "unlock_token", limit: 255 t.datetime "locked_at" t.datetime "created_at" t.datetime "updated_at" - t.boolean "is_allow_contact", default: true + t.boolean "is_allow_contact", default: true t.integer "group_id" - t.string "stp_customer_id" - t.string "username" - t.string "slug" - t.boolean "is_active", default: true + t.string "stp_customer_id", limit: 255 + t.string "username", limit: 255 + t.string "slug", limit: 255 + t.boolean "is_active", default: true t.string "provider" t.string "uid" t.string "auth_token"