Sha256: 58d29fe55e880e686156ab6ac86a43ae86e94f5bdd4af045ff0f0fdbc31608fb

Contents?: true

Size: 1.49 KB

Versions: 19

Compression:

Stored size: 1.49 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.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

19 entries across 19 versions & 2 rubygems

Version Path
active_record_survey-0.1.25 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey-0.1.23 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey-0.1.22 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey-0.1.21 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey_api-0.0.7 db/migrate/20150930031039_add_active_record_survey.rb
active_record_survey-0.1.20 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey-0.1.19 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey_api-0.0.6 db/migrate/20150930031039_add_active_record_survey.rb
active_record_survey-0.1.18 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey-0.1.17 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey-0.1.16 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey-0.1.15 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey_api-0.0.4 db/migrate/20150930031039_add_active_record_survey.rb
active_record_survey-0.1.14 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey-0.1.13 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey-0.1.12 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey-0.1.11 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey-0.1.10 lib/generators/active_record_survey/templates/migration_0.1.0.rb
active_record_survey-0.1.9 lib/generators/active_record_survey/templates/migration_0.1.0.rb