Sha256: 4d953f6e5391354c3d764742b6c560a3f84680b8a7458c726b40da4fb5089451

Contents?: true

Size: 1.51 KB

Versions: 9

Compression:

Stored size: 1.51 KB

Contents

class AddActiveRecordSurvey < ActiveRecord::Migration
	def self.up
		create_table :active_record_surveys do |t|
			t.timestamps null: false
		end

		create_table :active_record_survey_nodes do |t|
			t.string :type
			t.string :text

			t.timestamps null: false
		end

		create_table :active_record_survey_node_validations do |t|
			t.references :active_record_survey_node
			t.string :type
			t.string :value

			t.timestamps null: false
		end

		create_table :active_record_survey_node_maps do |t|
			t.references :active_record_survey_node

			# AwesomeNestedSet fields
			t.integer :parent_id, :null => true, :index => true
			t.integer :lft, :null => false, :index => true
			t.integer :rgt, :null => false, :index => true
			t.integer :depth, :null => false, :default => 0
			t.integer :children_count, :null => false, :default => 0

			t.references :active_record_survey

			t.timestamps null: false
		end

		create_table :active_record_survey_instances do |t|
			t.references :active_record_survey

			t.timestamps null: false
		end
		create_table :active_record_survey_instance_nodes do |t|
			t.references :active_record_survey_instance
			t.references :active_record_survey_node
			t.string :value

			t.timestamps null: false
		end
	end

	def self.down
		drop_table :active_record_surveys
		drop_table :active_record_survey_nodes
		drop_table :active_record_survey_node_validations
		drop_table :active_record_survey_node_maps
		drop_table :active_record_survey_instances
		drop_table :active_record_survey_instance_nodes
	end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
active_record_survey-0.1.8 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey-0.1.7 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey-0.1.6 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey-0.1.5 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey-0.1.4 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey-0.1.3 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey-0.1.2 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey-0.1.1 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey-0.1.0 lib/generators/active_record_survey/templates/migration_0.1.0.rb