SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Downloaden Sie, um offline zu lesen
ROR Lab. Season 3
                    - The 3th Round -


                 Database
                 Migrations

                     March 29th, 2013

                 ChangHoon Jeong(@seapy)
                        ROR Lab.


13년 3월 30일 토요일
General Migration

                 • Use SQL(Database dependent)
                 • Run SQL by DB console
                 • Telling other developer and run SQL their
                   local DB
                 • Run SQL when you deploy to production
                                                       ROR Lab.
13년 3월 30일 토요일
ROR Migration
                 • Use ruby code(Database independent)
                 • Run rake task
                 • Other developer run rake task(it’s rails
                   convention)
                 • Run rake task when you deploy to
                   production

                                                         ROR Lab.
13년 3월 30일 토요일
Migrations are Classes
                                                           rails 3.1 ~>
          class CreateProducts < ActiveRecord::Migration    class CreateProducts < ActiveRecord::Migration
            def up                                            def change
              create_table :products do |t|                     create_table :products do |t|
                t.string :name                                    t.string :name
                t.text :description                               t.text :description
                                                             
                t.timestamps                                      t.timestamps
              end                                               end
            end                                               end
                                                            end
            def down
              drop_table :products
            end
          end




                          subclass of ActiveRecord::Migration

                                                                                            ROR Lab.
13년 3월 30일 토요일
Migration methods
                                                   add_column
                                                    add_index
                 • Database independent way       change_column

                 • Execute method allows you to    change_table
                                                   create_table
                   execute arbitrary SQL
                                                    drop_table
                 • Migrations are wrapped in a    remove_column
                   transaction(PostgreSQL or      remove_index
                   SQLite3, not support MySQL)    rename_column
                                                  execute "SQL"

                                                    ROR Lab.
13년 3월 30일 토요일
Up & Down Methods (1)
                 class CreateProducts < ActiveRecord::Migration
                   def up
                     create_table :products do |t|
                       t.string :name
                       t.text :description
                  
                       t.timestamps
                     end
                   end                     updated_at, created_at
                  
                   def down
                     drop_table :products
                   end
                 end




                                                                    ROR Lab.
13년 3월 30일 토요일
Up & Down Methods (2)
                 class AddReceiveNewsletterToUsers < ActiveRecord::Migration
                   def up
                     change_table :users do |t|
                       t.boolean :receive_newsletter, :default => false
                     end
                     User.update_all ["receive_newsletter = ?", true]
                   end
                  
                   def down
                     remove_column :users, :receive_newsletter
                   end
                 end




                                                                           ROR Lab.
13년 3월 30일 토요일
Up & Down Methods (3)
                 class ExampleMigration < ActiveRecord::Migration
                   def up
                     create_table :products do |t|
                       t.references :category
                     end
                     #add a foreign key
                     execute <<-SQL
                                                       category_id
                       ALTER TABLE products
                         ADD CONSTRAINT fk_products_categories
                         FOREIGN KEY (category_id)
                         REFERENCES categories(id)
                     SQL
                     add_column :users, :home_page_url, :string
                     rename_column :users, :email, :email_address
                   end
                  
                   def down
                     rename_column :users, :email_address, :email
                     remove_column :users, :home_page_url
                     execute <<-SQL
                       ALTER TABLE products
                         DROP FOREIGN KEY fk_products_categories
                     SQL
                     drop_table :products
                   end
                 end



                                                                     ROR Lab.
13년 3월 30일 토요일
Up & Down Methods (3)
                 class ExampleMigration < ActiveRecord::Migration
                   def up
                     create_table :products do |t|
                       t.references :category
                     end
                     #add a foreign key
                     execute <<-SQL
                                                       category_id
                       ALTER TABLE products
                         ADD CONSTRAINT fk_products_categories
                         FOREIGN KEY (category_id)
                         REFERENCES categories(id)
                     SQL
                     add_column :users, :home_page_url, :string
                     rename_column :users, :email, :email_address
                   end
                  
                   def down
                     rename_column :users, :email_address, :email
                     remove_column :users, :home_page_url
                     execute <<-SQL
                       ALTER TABLE products
                         DROP FOREIGN KEY fk_products_categories
                     SQL
                     drop_table :products
                   end
                 end



                                                                     ROR Lab.
13년 3월 30일 토요일
Change Method
                 class CreateProducts < ActiveRecord::Migration
                   def change
                     create_table :products do |t|
                       t.string :name                 • create_table
                       t.text :description            • add_column
                                                      • add_index
                       t.timestamps                   • rename_table
                     end                              • rename_column
                   end                                • rename_index
                 end
                                                      • add_timestamps
                                                      • remove_timestamps




                                                                 ROR Lab.
13년 3월 30일 토요일
Supported Types
                  :binary
                :boolean
                    :date
               :datetime
                :decimal
                    :float
                             • not supported by Active Record
                 :integer
             :primary_key
                              • t.column :name, 'typename'
                   :string
                    :text
                    :time
              :timestamp
                                                     ROR Lab.
13년 3월 30일 토요일
Migration Files Naming

                 • db/migrate directory
                 • YYYYMMDDHHMMSS_create_products.rb
                  • UTC timestamp
                  • The name of the migration
                    class(CamelCased)


                                               ROR Lab.
13년 3월 30일 토요일
To Create
                     Migration Files
                 • $ rails generate model Post title:string
                 • $ rails generate scaffold Post title:string
                 • $ rails generate migration
                   AddContentToPosts content:text
                 • $ rails generate migration
                   RemoveContentFromPosts content:text

                                                          ROR Lab.
13년 3월 30일 토요일
Add & Remove
                      Columns
                 • AddXXXToYYY
                 • RemoveXXXFromYYY
                 $ rails g migration AddNameToUsers
                 $ rails g migration RemoveNameFromUsers


                                                  ROR Lab.
13년 3월 30일 토요일
To Destroy
                     Migration Files

                 • $ rails destroy model Post title:string
                 • $ rails destroy scaffold Post title:string
                 • $ rails destroy migration
                   AddContentToPosts content:text



                                                          ROR Lab.
13년 3월 30일 토요일
Rake it~

                 • $ rake db:migrate        “up” state

                 • $ rake db:rollback “down” state
                 • $ rake db:migrate:status
                                                 ROR Lab.
13년 3월 30일 토요일
Rake it~
      $ rake db:migrate:status                                              mysql> select * from schema_migrations;
                                                                            +----------------+
                                                                            | version        |
     database: medibook_development                                         +----------------+
                                                                            | 20120531061820 |
      Status   Migration ID    Migration Name                               | 20120531105534 |
                                                                            | 20120531124444 |
     --------------------------------------------------                     | 20120531125446 |
        up     20120531061820 Create users                                  | 20120531133035 |
        up     20120531105534 Rolify create roles                           | 20120601102629 |
        up     20120531124444 Create boards                                 | 20120603223525 |
        up     20120531125446 Create board types                            | 20120603224330 |
        up     20120531133035 Create posts                                  | 20120603224625 |
        up     20120601102629 Create categories                             | 20120604064155 |
                                                                            | 20120604110743 |
        up     20120603223525 Create products                               | 20120702123904 |
        up     20120603224330 Add some fields to users                      | 20120702125358 |
        up     20120603224625 Add some fields to categories                 | 20120703005951 |
        up     20120604064155 Add category id to products                   | 20120704033651 |
        up     20120604110743 Add attachment product photo to products      | 20120728014210 |
        up     20120702123904 Add view count to products                    | 20120728061841 |
        up     20120702125358 Create comments                               | 20120728102213 |
                                                                            | 20120729053924 |
        up     20120703005951 Create favourites                             | 20120804011723 |
        up     20120704033651 Add account to users                          | 20120804012821 |
        up     20120728014210 Add devise to users                           | 20120804013538 |
        up     20120728061841 Remove password digest from users             | 20120808023400 |
        up     20120728102213 Create user groups                            | 20120810071351 |
        up     20120729053924 Create users groups                           +----------------+
        up     20120804011723 Add user details to users                     34 rows in set (0.00 sec)
        up     20120804012821 Create affiliations
        up     20120804013538 Add some fields to affiliations
        up     20120808023400 Add attachment company logo to affiliations
        up     20120810071351 Add active to users


                                                                                             ROR Lab.
13년 3월 30일 토요일
Rake it~
                 $ rake db:version
                     Current version: 20120818023340



                 $ cat db/schema.rb

                 ActiveRecord::Schema.define(:version => 20120831045454) do

                   create_table   "ad_images", :force => true do |t|
                     t.integer    "adimageable_id"
                     t.string     "adimageable_type"
                     t.integer    "user_id"
                     t.string     "image_file_name"
                     t.string     "image_content_type"
                     t.integer    "image_file_size"
                     t.datetime   "created_at",         :null => false
                     t.datetime   "updated_at",         :null => false
                   end

                   add_index "ad_images", ["adimageable_id"], :name =>
                 "index_ad_images_on_adimageable_id"
                   add_index "ad_images", ["user_id"], :name =>
                 "index_ad_images_on_user_id"




                                                                              ROR Lab.
13년 3월 30일 토요일
Rake it~
                 $ rake db:abort_if_pending_migrations


       $ rake db:migrate:status                             $ rake db:abort_if_pending_migrations

       database: db/development.sqlite3                     You have 2 pending migrations:
                                                              20120818023340 CreateComments
        Status   Migration ID    Migration Name               20120818031154 CreateTags
       --------------------------------------------------   Run `rake db:migrate` to update your database then
          up     20120818022501 Create posts                try again.
         down    20120818023340 Create comments
         down    20120818031154 Create tags




                                                                                              ROR Lab.
13년 3월 30일 토요일
schema_migrations
                 • db/schema.rb
                 • A database table : history of migrations

                                      $ rake db:migrate:status
                                         • up
                                         • down

                                                         ROR Lab.
13년 3월 30일 토요일
Running Migrations
                                                                      db/schema.rb



                                             db:schema:dump
                 UP
                      $ rake db:migrate
                      $ rake db:migrate VERSION=20090906120000
                      $ rake db:migrate:up VERSION=20090906120000

       DOWN
                      $ rake db:rollback
                      $ rake db:rollback STEP=3




                                                                    ROR Lab.
13년 3월 30일 토요일
Running Migrations
                                                                 database: medibook_development

                                                                  Status   Migration ID
                                                                 --------------------------

        UP
                                                                    up     20120531061820
                                                                    up     20120531105534
                                                                    up     20120531124444
                                                                    up     20120531125446
                 $ rake db:migrate                                  up     20120531133035
                                                                    up     20120601102629
                 $ rake db:migrate VERSION=20120702125358           up     20120603223525
                                                                    up     20120603224330
                 $ rake db:migrate:down VERSION=20120702125358      up     20120603224625
                                                                    up     20120604064155
                                                                    up     20120604110743
                                                                    up     20120702123904
                                                                    up     20120702125358
                                                                    up     20120703005951
                                                                    up     20120704033651
                                                                    up     20120728014210
                                                                    up     20120728061841
                                                                    up     20120728102213
                                                                    up     20120729053924
                                                                    up     20120804011723

                       db:migrate:down
                                                                    up     20120804012821
                                                                    up     20120804013538
                                                                    up     20120808023400
                                                                    up     20120810071351




                                                                                  ROR Lab.
13년 3월 30일 토요일
Running Migrations
                                                               database: medibook_development

                                                                Status   Migration ID
                                                               --------------------------

        UP
                                                                  up     20120531061820
                                                                  up     20120531105534
                                                                  up     20120531124444
                                                                  up     20120531125446
                 $ rake db:migrate                                up     20120531133035
                                                                  up     20120601102629
                 $ rake db:migrate VERSION=20120702125358         up     20120603223525
                                                                  down   20120603224330
                 $ rake db:migrate:up VERSION=20120702125358      down   20120603224625
                                                                  down   20120604064155
                                                                  down   20120604110743
                                                                  down   20120702123904
                                                                  down   20120702125358
                                                                  down   20120703005951
                                                                  down   20120704033651
                                                                  down   20120728014210
                                                                  down   20120728061841
                                                                  down   20120728102213
                                                                  down   20120729053924
                                                                  down   20120804011723

                            db:migrate:up
                                                                  down   20120804012821
                                                                  down   20120804013538
                                                                  down   20120808023400
                                                                  down   20120810071351




                                                                                ROR Lab.
13년 3월 30일 토요일
Running Migrations
                                                 database: medibook_development

                                                  Status   Migration ID
                                                 --------------------------

        UP
                                                    up     20120531061820
                                                    up     20120531105534
                 $ rake db:rollback                 up     20120531124444
                                                    up     20120531125446
                 $ rake db:migrate:redo             up     20120531133035
                                                    up     20120601102629
                 $ rake db:rollback STEP=3          up     20120603223525
                                                    up     20120603224330
                 $ rake db:migrate:redo STEP=3      up     20120603224625
                                                    up     20120604064155
                                                    up     20120604110743
                                                    up     20120702123904
                                                    up     20120702125358
                                                    up     20120703005951
                                                    up     20120704033651
                                                    up     20120728014210
                                                    up     20120728061841
                                                    up     20120728102213
                                                    up     20120729053924
                                                    up     20120804011723
                                                    up     20120804012821
                                                    up     20120804013538
                                                    up     20120808023400
                                                    up     20120810071351




                                                                  ROR Lab.
13년 3월 30일 토요일
output of migrations
         • suppress_messages
         • say
          • indent option true/false
         • say_with_time
          • return integer, number of rows affected

                                                  ROR Lab.
13년 3월 30일 토요일
class CreateProducts < ActiveRecord::Migration
         def change
            suppress_messages do
                 create_table :products do |t|
                   t.string :name
                 end
            end
            say "Created a table"
            suppress_messages {add_index :products, :name}
            say "and an index!", true
            say_with_time 'Waiting for a while' do
                 sleep 10
                 250
            end                                  ==    CreateProducts: migrating ============

         end                                     -- Created a table

      end                                             -> and an index!
                                                 -- Waiting for a while
                                                      -> 10.0013s
                                                      -> 250 rows
                                                 ==    CreateProducts: migrated (10.0054s) ====



                                                                                ROR Lab.
13년 3월 30일 토요일
Model in Migration
                 • YourTable.reset_column_information
                    # db/migrate/20100513121110_add_flag_to_product.rb
                     
                    class AddFlagToProduct < ActiveRecord::Migration
                      class Product < ActiveRecord::Base
                      end
                     
                      def change
                        add_column :products, :flag, :integer
                        Product.reset_column_information
                        Product.all.each do |product|
                          product.update_attributes!(:flag => false)
                        end
                      end
                    end




                 • Alice and Bob’s Story
                                                                         ROR Lab.
13년 3월 30일 토요일
App DB Init
                                          using db/schema.rb

            $ rake db:setup                                              $ rake db:reset
                 1. db:create                                              1. db:drop
                 2. db:schema:load                                         2. db:setup
                 3. db:seed

                   https://github.com/rails/rails/blob/master/activerecord/lib/active_record/railties/databases.rake



                                                                                                            ROR Lab.
13년 3월 30일 토요일
Schema works

                 • $ rake db:schema:dump
                     called by db:migrate
                     create schema.rb


                 • $ rake db:schema:load
                     load schema.rb


                                            ROR Lab.
13년 3월 30일 토요일
감사합니다.

Weitere ähnliche Inhalte

Ähnlich wie Rails Database Migrations - RORLab Season 3-3

Rails Database Migration, Season 2
Rails Database Migration, Season 2Rails Database Migration, Season 2
Rails Database Migration, Season 2RORLAB
 
Rails DB migrations
Rails DB migrationsRails DB migrations
Rails DB migrationsDenys Kurets
 
Liquibase for java developers
Liquibase for java developersLiquibase for java developers
Liquibase for java developersIllia Seleznov
 
Rails vs Web2py
Rails vs Web2pyRails vs Web2py
Rails vs Web2pyjonromero
 
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...TAISEEREISA
 
Migration from Rails2 to Rails3
Migration from Rails2 to Rails3Migration from Rails2 to Rails3
Migration from Rails2 to Rails3Umair Amjad
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slidesmetsarin
 
Evolutionary Database Design
Evolutionary Database DesignEvolutionary Database Design
Evolutionary Database DesignAndrei Solntsev
 
Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptDrRShaliniVISTAS
 
Código Saudável => Programador Feliz - Rs on Rails 2010
Código Saudável => Programador Feliz - Rs on Rails 2010Código Saudável => Programador Feliz - Rs on Rails 2010
Código Saudável => Programador Feliz - Rs on Rails 2010Plataformatec
 
Procedures/functions of rdbms
Procedures/functions of rdbmsProcedures/functions of rdbms
Procedures/functions of rdbmsjain.pralabh
 
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...Alan Pinstein
 

Ähnlich wie Rails Database Migrations - RORLab Season 3-3 (20)

Rails Database Migration, Season 2
Rails Database Migration, Season 2Rails Database Migration, Season 2
Rails Database Migration, Season 2
 
Rails DB migrations
Rails DB migrationsRails DB migrations
Rails DB migrations
 
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with ExamplesDML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
 
Liquibase for java developers
Liquibase for java developersLiquibase for java developers
Liquibase for java developers
 
Rails vs Web2py
Rails vs Web2pyRails vs Web2py
Rails vs Web2py
 
SQL
SQLSQL
SQL
 
Sql lite android
Sql lite androidSql lite android
Sql lite android
 
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...
 
Two database findings
Two database findingsTwo database findings
Two database findings
 
Migration from Rails2 to Rails3
Migration from Rails2 to Rails3Migration from Rails2 to Rails3
Migration from Rails2 to Rails3
 
Lambdas and Laughs
Lambdas and LaughsLambdas and Laughs
Lambdas and Laughs
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slides
 
Lobos Introduction
Lobos IntroductionLobos Introduction
Lobos Introduction
 
Evolutionary Database Design
Evolutionary Database DesignEvolutionary Database Design
Evolutionary Database Design
 
Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.ppt
 
Código Saudável => Programador Feliz - Rs on Rails 2010
Código Saudável => Programador Feliz - Rs on Rails 2010Código Saudável => Programador Feliz - Rs on Rails 2010
Código Saudável => Programador Feliz - Rs on Rails 2010
 
SQL
SQLSQL
SQL
 
Procedures/functions of rdbms
Procedures/functions of rdbmsProcedures/functions of rdbms
Procedures/functions of rdbms
 
Sql server
Sql serverSql server
Sql server
 
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
 

Mehr von 창훈 정

Packer + Ansible을 이용한 AMI 생성 및 AutoScaling Group 이미지 교체 이야기
Packer + Ansible을 이용한 AMI 생성 및 AutoScaling Group 이미지 교체 이야기Packer + Ansible을 이용한 AMI 생성 및 AutoScaling Group 이미지 교체 이야기
Packer + Ansible을 이용한 AMI 생성 및 AutoScaling Group 이미지 교체 이야기창훈 정
 
개발자를 위한 Amazon Lightsail Deep-Dive
개발자를 위한 Amazon Lightsail Deep-Dive개발자를 위한 Amazon Lightsail Deep-Dive
개발자를 위한 Amazon Lightsail Deep-Dive창훈 정
 
AWS re:invent 2016 후기
AWS re:invent 2016 후기AWS re:invent 2016 후기
AWS re:invent 2016 후기창훈 정
 
AWSKRUG 정기 세미나 (2016년 9월) - Lambda + S3 썸네일 생성 및 운영
AWSKRUG 정기 세미나 (2016년 9월) - Lambda + S3 썸네일 생성 및 운영AWSKRUG 정기 세미나 (2016년 9월) - Lambda + S3 썸네일 생성 및 운영
AWSKRUG 정기 세미나 (2016년 9월) - Lambda + S3 썸네일 생성 및 운영창훈 정
 
형태소 분석기를 적용한 elasticsearch 운영
형태소 분석기를 적용한 elasticsearch 운영형태소 분석기를 적용한 elasticsearch 운영
형태소 분석기를 적용한 elasticsearch 운영창훈 정
 
boot2docker 사용시 컨테이너에서 생성한 데이터를 유지하기
boot2docker 사용시 컨테이너에서 생성한 데이터를 유지하기boot2docker 사용시 컨테이너에서 생성한 데이터를 유지하기
boot2docker 사용시 컨테이너에서 생성한 데이터를 유지하기창훈 정
 
ActiveRecord Associations(2) - RORLab Season 3-8
ActiveRecord Associations(2) - RORLab Season 3-8ActiveRecord Associations(2) - RORLab Season 3-8
ActiveRecord Associations(2) - RORLab Season 3-8창훈 정
 
ActiveRecord Observers - RORLab Season 3-6
ActiveRecord Observers - RORLab Season 3-6ActiveRecord Observers - RORLab Season 3-6
ActiveRecord Observers - RORLab Season 3-6창훈 정
 
ActiveRecord Associations(1) - RORLab Season 3-7
ActiveRecord Associations(1) - RORLab Season 3-7ActiveRecord Associations(1) - RORLab Season 3-7
ActiveRecord Associations(1) - RORLab Season 3-7창훈 정
 
ActiveRecord Callbacks - RORLab Season 3-5
ActiveRecord Callbacks - RORLab Season 3-5ActiveRecord Callbacks - RORLab Season 3-5
ActiveRecord Callbacks - RORLab Season 3-5창훈 정
 
Install Rails On Mac OS - RORLab Season 3-2
Install Rails On Mac OS - RORLab Season 3-2Install Rails On Mac OS - RORLab Season 3-2
Install Rails On Mac OS - RORLab Season 3-2창훈 정
 

Mehr von 창훈 정 (12)

Packer + Ansible을 이용한 AMI 생성 및 AutoScaling Group 이미지 교체 이야기
Packer + Ansible을 이용한 AMI 생성 및 AutoScaling Group 이미지 교체 이야기Packer + Ansible을 이용한 AMI 생성 및 AutoScaling Group 이미지 교체 이야기
Packer + Ansible을 이용한 AMI 생성 및 AutoScaling Group 이미지 교체 이야기
 
개발자를 위한 Amazon Lightsail Deep-Dive
개발자를 위한 Amazon Lightsail Deep-Dive개발자를 위한 Amazon Lightsail Deep-Dive
개발자를 위한 Amazon Lightsail Deep-Dive
 
AWS re:invent 2016 후기
AWS re:invent 2016 후기AWS re:invent 2016 후기
AWS re:invent 2016 후기
 
AWSKRUG 정기 세미나 (2016년 9월) - Lambda + S3 썸네일 생성 및 운영
AWSKRUG 정기 세미나 (2016년 9월) - Lambda + S3 썸네일 생성 및 운영AWSKRUG 정기 세미나 (2016년 9월) - Lambda + S3 썸네일 생성 및 운영
AWSKRUG 정기 세미나 (2016년 9월) - Lambda + S3 썸네일 생성 및 운영
 
형태소 분석기를 적용한 elasticsearch 운영
형태소 분석기를 적용한 elasticsearch 운영형태소 분석기를 적용한 elasticsearch 운영
형태소 분석기를 적용한 elasticsearch 운영
 
boot2docker 사용시 컨테이너에서 생성한 데이터를 유지하기
boot2docker 사용시 컨테이너에서 생성한 데이터를 유지하기boot2docker 사용시 컨테이너에서 생성한 데이터를 유지하기
boot2docker 사용시 컨테이너에서 생성한 데이터를 유지하기
 
ActiveRecord Associations(2) - RORLab Season 3-8
ActiveRecord Associations(2) - RORLab Season 3-8ActiveRecord Associations(2) - RORLab Season 3-8
ActiveRecord Associations(2) - RORLab Season 3-8
 
ActiveRecord Observers - RORLab Season 3-6
ActiveRecord Observers - RORLab Season 3-6ActiveRecord Observers - RORLab Season 3-6
ActiveRecord Observers - RORLab Season 3-6
 
ActiveRecord Associations(1) - RORLab Season 3-7
ActiveRecord Associations(1) - RORLab Season 3-7ActiveRecord Associations(1) - RORLab Season 3-7
ActiveRecord Associations(1) - RORLab Season 3-7
 
ActiveRecord Callbacks - RORLab Season 3-5
ActiveRecord Callbacks - RORLab Season 3-5ActiveRecord Callbacks - RORLab Season 3-5
ActiveRecord Callbacks - RORLab Season 3-5
 
Install Rails On Mac OS - RORLab Season 3-2
Install Rails On Mac OS - RORLab Season 3-2Install Rails On Mac OS - RORLab Season 3-2
Install Rails On Mac OS - RORLab Season 3-2
 
Vim for you
Vim for youVim for you
Vim for you
 

Kürzlich hochgeladen

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 

Kürzlich hochgeladen (20)

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 

Rails Database Migrations - RORLab Season 3-3

  • 1. ROR Lab. Season 3 - The 3th Round - Database Migrations March 29th, 2013 ChangHoon Jeong(@seapy) ROR Lab. 13년 3월 30일 토요일
  • 2. General Migration • Use SQL(Database dependent) • Run SQL by DB console • Telling other developer and run SQL their local DB • Run SQL when you deploy to production ROR Lab. 13년 3월 30일 토요일
  • 3. ROR Migration • Use ruby code(Database independent) • Run rake task • Other developer run rake task(it’s rails convention) • Run rake task when you deploy to production ROR Lab. 13년 3월 30일 토요일
  • 4. Migrations are Classes rails 3.1 ~> class CreateProducts < ActiveRecord::Migration class CreateProducts < ActiveRecord::Migration   def up   def change     create_table :products do |t|     create_table :products do |t|       t.string :name       t.string :name       t.text :description       t.text :description           t.timestamps       t.timestamps     end     end   end   end   end   def down     drop_table :products   end end subclass of ActiveRecord::Migration ROR Lab. 13년 3월 30일 토요일
  • 5. Migration methods add_column add_index • Database independent way change_column • Execute method allows you to change_table create_table execute arbitrary SQL drop_table • Migrations are wrapped in a remove_column transaction(PostgreSQL or remove_index SQLite3, not support MySQL) rename_column execute "SQL" ROR Lab. 13년 3월 30일 토요일
  • 6. Up & Down Methods (1) class CreateProducts < ActiveRecord::Migration   def up     create_table :products do |t|       t.string :name       t.text :description         t.timestamps     end   end updated_at, created_at     def down     drop_table :products   end end ROR Lab. 13년 3월 30일 토요일
  • 7. Up & Down Methods (2) class AddReceiveNewsletterToUsers < ActiveRecord::Migration   def up     change_table :users do |t|       t.boolean :receive_newsletter, :default => false     end     User.update_all ["receive_newsletter = ?", true]   end     def down     remove_column :users, :receive_newsletter   end end ROR Lab. 13년 3월 30일 토요일
  • 8. Up & Down Methods (3) class ExampleMigration < ActiveRecord::Migration   def up     create_table :products do |t|       t.references :category     end     #add a foreign key     execute <<-SQL category_id       ALTER TABLE products         ADD CONSTRAINT fk_products_categories         FOREIGN KEY (category_id)         REFERENCES categories(id)     SQL     add_column :users, :home_page_url, :string     rename_column :users, :email, :email_address   end     def down     rename_column :users, :email_address, :email     remove_column :users, :home_page_url     execute <<-SQL       ALTER TABLE products         DROP FOREIGN KEY fk_products_categories     SQL     drop_table :products   end end ROR Lab. 13년 3월 30일 토요일
  • 9. Up & Down Methods (3) class ExampleMigration < ActiveRecord::Migration   def up     create_table :products do |t|       t.references :category     end     #add a foreign key     execute <<-SQL category_id       ALTER TABLE products         ADD CONSTRAINT fk_products_categories         FOREIGN KEY (category_id)         REFERENCES categories(id)     SQL     add_column :users, :home_page_url, :string     rename_column :users, :email, :email_address   end     def down     rename_column :users, :email_address, :email     remove_column :users, :home_page_url     execute <<-SQL       ALTER TABLE products         DROP FOREIGN KEY fk_products_categories     SQL     drop_table :products   end end ROR Lab. 13년 3월 30일 토요일
  • 10. Change Method class CreateProducts < ActiveRecord::Migration   def change     create_table :products do |t|       t.string :name • create_table       t.text :description • add_column   • add_index       t.timestamps • rename_table     end • rename_column   end • rename_index end • add_timestamps • remove_timestamps ROR Lab. 13년 3월 30일 토요일
  • 11. Supported Types :binary :boolean :date :datetime :decimal :float • not supported by Active Record :integer :primary_key • t.column :name, 'typename' :string :text :time :timestamp ROR Lab. 13년 3월 30일 토요일
  • 12. Migration Files Naming • db/migrate directory • YYYYMMDDHHMMSS_create_products.rb • UTC timestamp • The name of the migration class(CamelCased) ROR Lab. 13년 3월 30일 토요일
  • 13. To Create Migration Files • $ rails generate model Post title:string • $ rails generate scaffold Post title:string • $ rails generate migration AddContentToPosts content:text • $ rails generate migration RemoveContentFromPosts content:text ROR Lab. 13년 3월 30일 토요일
  • 14. Add & Remove Columns • AddXXXToYYY • RemoveXXXFromYYY $ rails g migration AddNameToUsers $ rails g migration RemoveNameFromUsers ROR Lab. 13년 3월 30일 토요일
  • 15. To Destroy Migration Files • $ rails destroy model Post title:string • $ rails destroy scaffold Post title:string • $ rails destroy migration AddContentToPosts content:text ROR Lab. 13년 3월 30일 토요일
  • 16. Rake it~ • $ rake db:migrate “up” state • $ rake db:rollback “down” state • $ rake db:migrate:status ROR Lab. 13년 3월 30일 토요일
  • 17. Rake it~ $ rake db:migrate:status mysql> select * from schema_migrations; +----------------+ | version | database: medibook_development +----------------+ | 20120531061820 | Status Migration ID Migration Name | 20120531105534 | | 20120531124444 | -------------------------------------------------- | 20120531125446 | up 20120531061820 Create users | 20120531133035 | up 20120531105534 Rolify create roles | 20120601102629 | up 20120531124444 Create boards | 20120603223525 | up 20120531125446 Create board types | 20120603224330 | up 20120531133035 Create posts | 20120603224625 | up 20120601102629 Create categories | 20120604064155 | | 20120604110743 | up 20120603223525 Create products | 20120702123904 | up 20120603224330 Add some fields to users | 20120702125358 | up 20120603224625 Add some fields to categories | 20120703005951 | up 20120604064155 Add category id to products | 20120704033651 | up 20120604110743 Add attachment product photo to products | 20120728014210 | up 20120702123904 Add view count to products | 20120728061841 | up 20120702125358 Create comments | 20120728102213 | | 20120729053924 | up 20120703005951 Create favourites | 20120804011723 | up 20120704033651 Add account to users | 20120804012821 | up 20120728014210 Add devise to users | 20120804013538 | up 20120728061841 Remove password digest from users | 20120808023400 | up 20120728102213 Create user groups | 20120810071351 | up 20120729053924 Create users groups +----------------+ up 20120804011723 Add user details to users 34 rows in set (0.00 sec) up 20120804012821 Create affiliations up 20120804013538 Add some fields to affiliations up 20120808023400 Add attachment company logo to affiliations up 20120810071351 Add active to users ROR Lab. 13년 3월 30일 토요일
  • 18. Rake it~ $ rake db:version Current version: 20120818023340 $ cat db/schema.rb ActiveRecord::Schema.define(:version => 20120831045454) do create_table "ad_images", :force => true do |t| t.integer "adimageable_id" t.string "adimageable_type" t.integer "user_id" t.string "image_file_name" t.string "image_content_type" t.integer "image_file_size" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false end add_index "ad_images", ["adimageable_id"], :name => "index_ad_images_on_adimageable_id" add_index "ad_images", ["user_id"], :name => "index_ad_images_on_user_id" ROR Lab. 13년 3월 30일 토요일
  • 19. Rake it~ $ rake db:abort_if_pending_migrations $ rake db:migrate:status $ rake db:abort_if_pending_migrations database: db/development.sqlite3 You have 2 pending migrations: 20120818023340 CreateComments Status Migration ID Migration Name 20120818031154 CreateTags -------------------------------------------------- Run `rake db:migrate` to update your database then up 20120818022501 Create posts try again. down 20120818023340 Create comments down 20120818031154 Create tags ROR Lab. 13년 3월 30일 토요일
  • 20. schema_migrations • db/schema.rb • A database table : history of migrations $ rake db:migrate:status • up • down ROR Lab. 13년 3월 30일 토요일
  • 21. Running Migrations db/schema.rb db:schema:dump UP $ rake db:migrate $ rake db:migrate VERSION=20090906120000 $ rake db:migrate:up VERSION=20090906120000 DOWN $ rake db:rollback $ rake db:rollback STEP=3 ROR Lab. 13년 3월 30일 토요일
  • 22. Running Migrations database: medibook_development Status Migration ID -------------------------- UP up 20120531061820 up 20120531105534 up 20120531124444 up 20120531125446 $ rake db:migrate up 20120531133035 up 20120601102629 $ rake db:migrate VERSION=20120702125358 up 20120603223525 up 20120603224330 $ rake db:migrate:down VERSION=20120702125358 up 20120603224625 up 20120604064155 up 20120604110743 up 20120702123904 up 20120702125358 up 20120703005951 up 20120704033651 up 20120728014210 up 20120728061841 up 20120728102213 up 20120729053924 up 20120804011723 db:migrate:down up 20120804012821 up 20120804013538 up 20120808023400 up 20120810071351 ROR Lab. 13년 3월 30일 토요일
  • 23. Running Migrations database: medibook_development Status Migration ID -------------------------- UP up 20120531061820 up 20120531105534 up 20120531124444 up 20120531125446 $ rake db:migrate up 20120531133035 up 20120601102629 $ rake db:migrate VERSION=20120702125358 up 20120603223525 down 20120603224330 $ rake db:migrate:up VERSION=20120702125358 down 20120603224625 down 20120604064155 down 20120604110743 down 20120702123904 down 20120702125358 down 20120703005951 down 20120704033651 down 20120728014210 down 20120728061841 down 20120728102213 down 20120729053924 down 20120804011723 db:migrate:up down 20120804012821 down 20120804013538 down 20120808023400 down 20120810071351 ROR Lab. 13년 3월 30일 토요일
  • 24. Running Migrations database: medibook_development Status Migration ID -------------------------- UP up 20120531061820 up 20120531105534 $ rake db:rollback up 20120531124444 up 20120531125446 $ rake db:migrate:redo up 20120531133035 up 20120601102629 $ rake db:rollback STEP=3 up 20120603223525 up 20120603224330 $ rake db:migrate:redo STEP=3 up 20120603224625 up 20120604064155 up 20120604110743 up 20120702123904 up 20120702125358 up 20120703005951 up 20120704033651 up 20120728014210 up 20120728061841 up 20120728102213 up 20120729053924 up 20120804011723 up 20120804012821 up 20120804013538 up 20120808023400 up 20120810071351 ROR Lab. 13년 3월 30일 토요일
  • 25. output of migrations • suppress_messages • say • indent option true/false • say_with_time • return integer, number of rows affected ROR Lab. 13년 3월 30일 토요일
  • 26. class CreateProducts < ActiveRecord::Migration def change suppress_messages do create_table :products do |t| t.string :name end end say "Created a table" suppress_messages {add_index :products, :name} say "and an index!", true say_with_time 'Waiting for a while' do sleep 10 250 end == CreateProducts: migrating ============ end -- Created a table end -> and an index! -- Waiting for a while -> 10.0013s -> 250 rows == CreateProducts: migrated (10.0054s) ==== ROR Lab. 13년 3월 30일 토요일
  • 27. Model in Migration • YourTable.reset_column_information # db/migrate/20100513121110_add_flag_to_product.rb   class AddFlagToProduct < ActiveRecord::Migration   class Product < ActiveRecord::Base   end     def change     add_column :products, :flag, :integer     Product.reset_column_information     Product.all.each do |product|       product.update_attributes!(:flag => false)     end   end end • Alice and Bob’s Story ROR Lab. 13년 3월 30일 토요일
  • 28. App DB Init using db/schema.rb $ rake db:setup $ rake db:reset 1. db:create 1. db:drop 2. db:schema:load 2. db:setup 3. db:seed https://github.com/rails/rails/blob/master/activerecord/lib/active_record/railties/databases.rake ROR Lab. 13년 3월 30일 토요일
  • 29. Schema works • $ rake db:schema:dump called by db:migrate create schema.rb • $ rake db:schema:load load schema.rb ROR Lab. 13년 3월 30일 토요일
  • 31.   13년 3월 30일 토요일