Sha256: fcde1944c7ea1e6e55ed06cfbd607777ce6ed0a0749b51763bf15b243987008a
Contents?: true
Size: 1.05 KB
Versions: 75
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true class AddSlugToDecidimConsultationsQuestions < ActiveRecord::Migration[5.1] class Question < ApplicationRecord self.table_name = :decidim_consultations_questions end def change add_column :decidim_consultations_questions, :decidim_organization_id, :integer, index: { name: "index_decidim_questions_on_decidim_organization_id" } add_column :decidim_consultations_questions, :slug, :string Question.find_each do |question| question.decidim_organization_id = question.consultation.decidim_organization_id question.slug = "q-#{question.id}" question.save end change_column_null :decidim_consultations_questions, :decidim_organization_id, false change_column_null :decidim_consultations_questions, :slug, false add_index :decidim_consultations_questions, [:decidim_organization_id, :slug], name: "index_unique_question_slug_and_organization", unique: true end end
Version data entries
75 entries across 75 versions & 1 rubygems