Sha256: ef0d9b1b3244de4d9524ba1e30920f52e6bcc795a47931d3d13f1a2aed38c329

Contents?: true

Size: 1.21 KB

Versions: 7

Compression:

Stored size: 1.21 KB

Contents

require 'rake'

module TestDb

  def self.up

    ActiveRecord::Base.connection.create_table :documents, force: true do |t|
      t.string :name
      t.string :surname
      t.boolean :keep_alive
      t.datetime :date
      t.decimal :price, precision: 6, scale: 2
      t.decimal :average, precision: 6, scale: 3
      t.timestamps
    end

    ActiveRecord::Base.connection.create_table :sections, force: true do |t|
      t.string :title
      t.integer :document_id
      t.integer :chapter_id
      t.timestamps
    end

    ActiveRecord::Base.connection.create_table :authors, force: true do |t|
      t.string :name
      t.integer :document_id
      t.timestamps
    end

    ActiveRecord::Base.connection.create_table :chapters, force: true do |t|
      t.string :title
      t.timestamps
    end

    ActiveRecord::Base.connection.create_table :users, force: true do |t|
      t.string :email
      t.string :firstname
      t.string :lastname
      t.timestamps
    end
  end

  def self.down
    ActiveRecord::Base.connection.drop_table :users
    ActiveRecord::Base.connection.drop_table :chapters
    ActiveRecord::Base.connection.drop_table :sections
    ActiveRecord::Base.connection.drop_table :documents
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
active_metadata-0.8.9 spec/support/migrations.rb
active_metadata-0.8.8 spec/support/migrations.rb
active_metadata-0.8.7.1 spec/support/migrations.rb
active_metadata-0.8.7 spec/support/migrations.rb
active_metadata-0.8.6 spec/support/migrations.rb
active_metadata-0.8.5.2 spec/support/migrations.rb
active_metadata-0.8.5.1 spec/support/migrations.rb