Sha256: de48eb50e4aa303456c0daceeda5293836b4826857dcceb8f1766530031f3910
Contents?: true
Size: 1.14 KB
Versions: 16
Compression:
Stored size: 1.14 KB
Contents
class CreateBitCoreSlides < ActiveRecord::Migration def change create_table :bit_core_slides do |t| t.string :title, null: false t.text :body, null: false t.integer :position, null: false, default: 1 t.integer :bit_core_slideshow_id, null: false t.string :type t.boolean :is_title_visible, null: false, default: true t.timestamps end reversible do |dir| dir.up do execute <<-SQL ALTER TABLE bit_core_slides ADD CONSTRAINT bit_core_slide_position UNIQUE (bit_core_slideshow_id, position) DEFERRABLE INITIALLY IMMEDIATE SQL execute <<-SQL ALTER TABLE bit_core_slides ADD CONSTRAINT fk_slideshows_slides FOREIGN KEY (bit_core_slideshow_id) REFERENCES bit_core_slideshows(id) SQL end dir.down do execute <<-SQL ALTER TABLE bit_core_slides DROP CONSTRAINT fk_slideshows_slides SQL execute <<-SQL ALTER TABLE bit_core_slides DROP CONSTRAINT IF EXISTS bit_core_slide_position SQL end end end end
Version data entries
16 entries across 16 versions & 1 rubygems