how database migration work

<?xml version="1.0" encoding="UTF-8"?>

<databaseChangeLog
  xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">

    <changeSet id="1" author="bob">
        <createTable tableName="department">
            <column name="id" type="int">
                <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="name" type="varchar(50)">
                <constraints nullable="false"/>
            </column>
            <column name="active" type="boolean" defaultValueBoolean="true"/>
        </createTable>
    </changeSet>

</databaseChangeLog>

4
10
Seel 110 points

                                    class ChangeProductsPrice &lt; ActiveRecord::Migration[5.0]
  def change
    reversible do |dir|
      change_table :products do |t|
        dir.up   { t.change :price, :string }
        dir.down { t.change :price, :integer }
      end
    end
  end
end

4 (10 Votes)
0
4
4

                                    class CreateProducts &lt; ActiveRecord::Migration[5.0]
  def change
    create_table :products do |t|
      t.string :name
      t.text :description
 
      t.timestamps
    end
  end
end

4 (4 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
step migration database why we need migrations in database how to migration to why do we use migrations for a database why database migration understanding database migrations db migration steps what is migration in db create table with migrations what is database migrations make data migration database add migration migration in database how to create migration database migration command SQL database migrations use migration classes with new database how to make migration table what does database migration mean database migration steps sql db migration what does make migration do database migration making a migration add migration to database are database migration necessary are database migrations necessary why we use migration in database what i have to write on migration to create the database create database on migration How to create database from migration why use database migrations? microsoft database migration database migrations explained what need to migration in database what is migration db why use a database migration tool how to make migration how system migration work why you should use database migrations database migration file create migration table. migration database write database migration create table using migration sql project migration tutorial create table in database using migration make migration what are migrations in database set up the new migrations table in database how create migration migrations database table how to write migrations in sql create migrations for sql database should i use database migration should i use database migrations db migration database what is a migration in database migration in db use migrations to create the database sql database migration database to migration what is a database migration database what is migration what is database migration What is a database migration? what's migration in db whats migration in db what are database migrations database migrations how doing sql migration database migration migrations database what is migration in database what does migrate a database mean what is a migration in backend database designer migration what is a databawse migration how does database migration work migration meaning database definition migration meaning database what is migrating a database mean ehat is db migration what does it mean to migrate a database is it db.migration or db/migration mysql migration mean understanding database migration when you need to migrate database db migration how database migration work
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source