SlideShare a Scribd company logo
HTTPS://GITHUB.COM/WINEBARREL/RIDGEPOLE
mysql> create database ridgepole_test
gem install –g ridgepole
yum install epel-release
yum install ruby
yum groupinstall "Development Tools“
yum install mysql-devel
gem install –g mysql2
# vi config.yml
development_1:
adapter: mysql2
encoding: utf8
host: <%= ENV['MYSQL_HOST'] %>
port: 3306
database: ridgepole_test
username: root
#password:
production:
・・・・
# vi Schemafile
create_table "articles", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "title", collation: "ascii_bin"
t.text "text", null: false, collation: "utf8mb4_bin"
t.datetime "created_at"
t.datetime "updated_at"
end
# MYSQL_HOST=10.10.10.11 
ridgepole --config config.yml -E development_1 --file Schemafile --apply --dry-run
# CREATE TABLE `articles` (
# `id` int(11) auto_increment PRIMARY KEY,
# `title` varchar(255),
# `text` text NOT NULL,
# `created_at` datetime,
# `updated_at` datetime)
# ENGINE=InnoDB DEFAULT CHARSET=utf8
# MYSQL_HOST=10.10.10.11 
ridgepole --config config.yml -E development_1 --file Schemafile --apply
Apply `schemafile`
-- create_table("articles", {:options=>"ENGINE=InnoDB DEFAULT CHARSET=utf8"})
-> 0.0146s
cadmin@host1:~ $ mysql -u root -h 10.10.10.11 -D ridgepole_test -e 'show create table
articlesG'
Table: articles
Create Table: CREATE TABLE `articles` (
`id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) DEFAULT NULL,
`text` text NOT NULL, `created_at` datetime DEFAULT NULL, `updated_at` datetime DEFAULT
NULL, PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
# vi Schemafile
create_table "articles", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "title", null: false collation: "ascii_bin"
t.datetime "created_at"
t.datetime "updated_at"
end
# MYSQL_HOST=10.10.10.11 
ridgepole --config config.yml -E development_1 --file Schemafile –apply –dry-run
# ALTER TABLE `articles` CHANGE `title` `title` varchar(255) NOT NULL
# ALTER TABLE `articles` DROP `text`
Create Table: CREATE TABLE `articles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
Database Schema as Code
Database Schema as Code

More Related Content

What's hot

Redmine on amazon ec2
Redmine on amazon ec2Redmine on amazon ec2
Redmine on amazon ec2
Ikuru Kanuma
 
Philipp Krenn "Elasticsearch (R)Evolution — You Know, for Search…"
Philipp Krenn "Elasticsearch (R)Evolution — You Know, for Search…"Philipp Krenn "Elasticsearch (R)Evolution — You Know, for Search…"
Philipp Krenn "Elasticsearch (R)Evolution — You Know, for Search…"
Fwdays
 
Talk NullByteCon 2015
Talk NullByteCon 2015Talk NullByteCon 2015
Talk NullByteCon 2015
Roberto Soares
 
JavaScript, Meet Cloud : Node.js on Windows Azure
JavaScript, Meet Cloud : Node.js on Windows AzureJavaScript, Meet Cloud : Node.js on Windows Azure
JavaScript, Meet Cloud : Node.js on Windows Azure
Shiju Varghese
 
2 docker engine_hands_on
2 docker engine_hands_on2 docker engine_hands_on
2 docker engine_hands_on
FEG
 
Javascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJSJavascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJSLadislav Prskavec
 
Openstack kilo installation using rdo
Openstack kilo installation using rdoOpenstack kilo installation using rdo
Openstack kilo installation using rdoNarasimha sreeram
 
Rails with MongoDB - RORLab 47th
Rails with MongoDB - RORLab 47th Rails with MongoDB - RORLab 47th
Rails with MongoDB - RORLab 47th
Eugene Park
 
Openstack installation using rdo multi node
Openstack installation using rdo multi nodeOpenstack installation using rdo multi node
Openstack installation using rdo multi node
Narasimha sreeram
 
Beyond Golden Containers: Complementing Docker with Puppet
Beyond Golden Containers: Complementing Docker with PuppetBeyond Golden Containers: Complementing Docker with Puppet
Beyond Golden Containers: Complementing Docker with Puppet
lutter
 
Create a RESTful API with NodeJS, Express and MongoDB
Create a RESTful API with NodeJS, Express and MongoDBCreate a RESTful API with NodeJS, Express and MongoDB
Create a RESTful API with NodeJS, Express and MongoDB
Hengki Sihombing
 
Deep Visibility for Production Microservices
Deep Visibility for Production MicroservicesDeep Visibility for Production Microservices
Deep Visibility for Production Microservices
Paul Bauer
 
Profiling with Xhprof
Profiling with XhprofProfiling with Xhprof
Profiling with Xhprof
Tim Massey
 
konfigurasi freeradius + daloradius in debian 9
konfigurasi freeradius + daloradius in debian 9konfigurasi freeradius + daloradius in debian 9
konfigurasi freeradius + daloradius in debian 9
Walid Umar
 
AnsibleではじめるNW設定の自動化について - Cisco(VIRL)編 -
AnsibleではじめるNW設定の自動化について - Cisco(VIRL)編 -AnsibleではじめるNW設定の自動化について - Cisco(VIRL)編 -
AnsibleではじめるNW設定の自動化について - Cisco(VIRL)編 -
Yasuyuki Sugai
 
Triangle OpenStack meetup 09 2013
Triangle OpenStack meetup 09 2013Triangle OpenStack meetup 09 2013
Triangle OpenStack meetup 09 2013
Dan Radez
 
Es part 2 pdf no build
Es part 2 pdf no buildEs part 2 pdf no build
Es part 2 pdf no buildErik Rose
 
How to Install Ghost (CMS) MEMO
How to Install Ghost (CMS) MEMOHow to Install Ghost (CMS) MEMO
How to Install Ghost (CMS) MEMO
Naoto MATSUMOTO
 
Ansible basics workshop
Ansible basics workshopAnsible basics workshop
Ansible basics workshop
David Karban
 

What's hot (20)

Redmine on amazon ec2
Redmine on amazon ec2Redmine on amazon ec2
Redmine on amazon ec2
 
Philipp Krenn "Elasticsearch (R)Evolution — You Know, for Search…"
Philipp Krenn "Elasticsearch (R)Evolution — You Know, for Search…"Philipp Krenn "Elasticsearch (R)Evolution — You Know, for Search…"
Philipp Krenn "Elasticsearch (R)Evolution — You Know, for Search…"
 
Talk NullByteCon 2015
Talk NullByteCon 2015Talk NullByteCon 2015
Talk NullByteCon 2015
 
JavaScript, Meet Cloud : Node.js on Windows Azure
JavaScript, Meet Cloud : Node.js on Windows AzureJavaScript, Meet Cloud : Node.js on Windows Azure
JavaScript, Meet Cloud : Node.js on Windows Azure
 
2 docker engine_hands_on
2 docker engine_hands_on2 docker engine_hands_on
2 docker engine_hands_on
 
Javascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJSJavascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJS
 
Openstack kilo installation using rdo
Openstack kilo installation using rdoOpenstack kilo installation using rdo
Openstack kilo installation using rdo
 
Rails with MongoDB - RORLab 47th
Rails with MongoDB - RORLab 47th Rails with MongoDB - RORLab 47th
Rails with MongoDB - RORLab 47th
 
Openstack installation using rdo multi node
Openstack installation using rdo multi nodeOpenstack installation using rdo multi node
Openstack installation using rdo multi node
 
Beyond Golden Containers: Complementing Docker with Puppet
Beyond Golden Containers: Complementing Docker with PuppetBeyond Golden Containers: Complementing Docker with Puppet
Beyond Golden Containers: Complementing Docker with Puppet
 
Create a RESTful API with NodeJS, Express and MongoDB
Create a RESTful API with NodeJS, Express and MongoDBCreate a RESTful API with NodeJS, Express and MongoDB
Create a RESTful API with NodeJS, Express and MongoDB
 
Deep Visibility for Production Microservices
Deep Visibility for Production MicroservicesDeep Visibility for Production Microservices
Deep Visibility for Production Microservices
 
Profiling with Xhprof
Profiling with XhprofProfiling with Xhprof
Profiling with Xhprof
 
konfigurasi freeradius + daloradius in debian 9
konfigurasi freeradius + daloradius in debian 9konfigurasi freeradius + daloradius in debian 9
konfigurasi freeradius + daloradius in debian 9
 
AnsibleではじめるNW設定の自動化について - Cisco(VIRL)編 -
AnsibleではじめるNW設定の自動化について - Cisco(VIRL)編 -AnsibleではじめるNW設定の自動化について - Cisco(VIRL)編 -
AnsibleではじめるNW設定の自動化について - Cisco(VIRL)編 -
 
Triangle OpenStack meetup 09 2013
Triangle OpenStack meetup 09 2013Triangle OpenStack meetup 09 2013
Triangle OpenStack meetup 09 2013
 
Es part 2 pdf no build
Es part 2 pdf no buildEs part 2 pdf no build
Es part 2 pdf no build
 
How to Install Ghost (CMS) MEMO
How to Install Ghost (CMS) MEMOHow to Install Ghost (CMS) MEMO
How to Install Ghost (CMS) MEMO
 
Ansible basics workshop
Ansible basics workshopAnsible basics workshop
Ansible basics workshop
 
Jk rubyslava 25
Jk rubyslava 25Jk rubyslava 25
Jk rubyslava 25
 

Viewers also liked

Blogs pgw 11.10.16 web
Blogs pgw 11.10.16 webBlogs pgw 11.10.16 web
Blogs pgw 11.10.16 web
didactic_dude
 
Creación de una lan
Creación de una lanCreación de una lan
Creación de una lan
Valentin Hernandez Sosa
 
Historia patinaje II Luis J. Jimnenez
Historia patinaje II Luis J. JimnenezHistoria patinaje II Luis J. Jimnenez
Historia patinaje II Luis J. Jimnenez
Luis José Jiménez Laín
 
[오픈소스컨설팅]Session 3. atlassian 도입 1년차 조직의 고민
[오픈소스컨설팅]Session 3. atlassian 도입 1년차 조직의 고민[오픈소스컨설팅]Session 3. atlassian 도입 1년차 조직의 고민
[오픈소스컨설팅]Session 3. atlassian 도입 1년차 조직의 고민
Hee Jae Lee
 
Eves Reference for professional employee
Eves Reference for professional employeeEves Reference for professional employee
Eves Reference for professional employeeDonna Luciw
 
Arquitectura islamica
Arquitectura islamicaArquitectura islamica
Arquitectura islamica
Lucila Gonzalez
 
C olònies
C olòniesC olònies
Ud 4 el islam en la península1
Ud 4 el islam en la península1Ud 4 el islam en la península1
Ud 4 el islam en la península1
Serafin Becerra
 
Ocupación de Antofagasta. Por Antonio Parvex
Ocupación de Antofagasta. Por Antonio ParvexOcupación de Antofagasta. Por Antonio Parvex
Ocupación de Antofagasta. Por Antonio Parvex
academiahistoriamilitar
 
La pesca milagrosa ev
La pesca milagrosa evLa pesca milagrosa ev
La pesca milagrosa ev
hjonilton
 
1. Per una cultura digitale
1. Per una cultura digitale1. Per una cultura digitale
1. Per una cultura digitale
Flavia Rubino | The Talking Village
 
SSRN-id2816685
SSRN-id2816685SSRN-id2816685
SSRN-id2816685Dean Dagan
 

Viewers also liked (15)

Blogs pgw 11.10.16 web
Blogs pgw 11.10.16 webBlogs pgw 11.10.16 web
Blogs pgw 11.10.16 web
 
Creación de una lan
Creación de una lanCreación de una lan
Creación de una lan
 
Gost 9908 75
 Gost 9908 75 Gost 9908 75
Gost 9908 75
 
Historia patinaje II Luis J. Jimnenez
Historia patinaje II Luis J. JimnenezHistoria patinaje II Luis J. Jimnenez
Historia patinaje II Luis J. Jimnenez
 
[오픈소스컨설팅]Session 3. atlassian 도입 1년차 조직의 고민
[오픈소스컨설팅]Session 3. atlassian 도입 1년차 조직의 고민[오픈소스컨설팅]Session 3. atlassian 도입 1년차 조직의 고민
[오픈소스컨설팅]Session 3. atlassian 도입 1년차 조직의 고민
 
Eves Reference for professional employee
Eves Reference for professional employeeEves Reference for professional employee
Eves Reference for professional employee
 
Arquitectura islamica
Arquitectura islamicaArquitectura islamica
Arquitectura islamica
 
Los cuadrilateros
Los cuadrilaterosLos cuadrilateros
Los cuadrilateros
 
C olònies
C olòniesC olònies
C olònies
 
Report_2
Report_2Report_2
Report_2
 
Ud 4 el islam en la península1
Ud 4 el islam en la península1Ud 4 el islam en la península1
Ud 4 el islam en la península1
 
Ocupación de Antofagasta. Por Antonio Parvex
Ocupación de Antofagasta. Por Antonio ParvexOcupación de Antofagasta. Por Antonio Parvex
Ocupación de Antofagasta. Por Antonio Parvex
 
La pesca milagrosa ev
La pesca milagrosa evLa pesca milagrosa ev
La pesca milagrosa ev
 
1. Per una cultura digitale
1. Per una cultura digitale1. Per una cultura digitale
1. Per una cultura digitale
 
SSRN-id2816685
SSRN-id2816685SSRN-id2816685
SSRN-id2816685
 

Similar to Database Schema as Code

Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.
Prajal Kulkarni
 
Linux configer
Linux configerLinux configer
Linux configer
MD. AL AMIN
 
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
addame
 
MeaNstack on Docker
MeaNstack on DockerMeaNstack on Docker
MeaNstack on Docker
Daniel Ku
 
Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册Yiwei Ma
 
X64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newX64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newYiwei Ma
 
MySQL Spider Architecture
MySQL Spider ArchitectureMySQL Spider Architecture
MySQL Spider Architecture
I Goo Lee
 
Spider Setup with AWS/sandbox
Spider Setup with AWS/sandboxSpider Setup with AWS/sandbox
Spider Setup with AWS/sandbox
I Goo Lee
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
John Lynch
 
Testing your infrastructure with litmus
Testing your infrastructure with litmusTesting your infrastructure with litmus
Testing your infrastructure with litmus
Bram Vogelaar
 
Practical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppPractical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails App
SmartLogic
 
Ansible inside
Ansible insideAnsible inside
Ansible inside
Ideato
 
Automatically Scaling Your Kubernetes Workloads - SVC209-S - Anaheim AWS Summit
Automatically Scaling Your Kubernetes Workloads - SVC209-S - Anaheim AWS SummitAutomatically Scaling Your Kubernetes Workloads - SVC209-S - Anaheim AWS Summit
Automatically Scaling Your Kubernetes Workloads - SVC209-S - Anaheim AWS Summit
Amazon Web Services
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetOmar Reygaert
 
Multiple instances on linux
Multiple instances on linuxMultiple instances on linux
Multiple instances on linux
Vasudeva Rao
 
Nginx 0.9.x 安装手册
Nginx 0.9.x 安装手册Nginx 0.9.x 安装手册
Nginx 0.9.x 安装手册Yiwei Ma
 
Making Your Capistrano Recipe Book
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe Book
Tim Riley
 
Vancouver presentation
Vancouver presentationVancouver presentation
Vancouver presentation
Colleen_Murphy
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013
grim_radical
 
Automating Front-End Workflow
Automating Front-End WorkflowAutomating Front-End Workflow
Automating Front-End Workflow
Dimitris Tsironis
 

Similar to Database Schema as Code (20)

Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.
 
Linux configer
Linux configerLinux configer
Linux configer
 
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
 
MeaNstack on Docker
MeaNstack on DockerMeaNstack on Docker
MeaNstack on Docker
 
Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册
 
X64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newX64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 new
 
MySQL Spider Architecture
MySQL Spider ArchitectureMySQL Spider Architecture
MySQL Spider Architecture
 
Spider Setup with AWS/sandbox
Spider Setup with AWS/sandboxSpider Setup with AWS/sandbox
Spider Setup with AWS/sandbox
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Testing your infrastructure with litmus
Testing your infrastructure with litmusTesting your infrastructure with litmus
Testing your infrastructure with litmus
 
Practical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppPractical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails App
 
Ansible inside
Ansible insideAnsible inside
Ansible inside
 
Automatically Scaling Your Kubernetes Workloads - SVC209-S - Anaheim AWS Summit
Automatically Scaling Your Kubernetes Workloads - SVC209-S - Anaheim AWS SummitAutomatically Scaling Your Kubernetes Workloads - SVC209-S - Anaheim AWS Summit
Automatically Scaling Your Kubernetes Workloads - SVC209-S - Anaheim AWS Summit
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + Puppet
 
Multiple instances on linux
Multiple instances on linuxMultiple instances on linux
Multiple instances on linux
 
Nginx 0.9.x 安装手册
Nginx 0.9.x 安装手册Nginx 0.9.x 安装手册
Nginx 0.9.x 安装手册
 
Making Your Capistrano Recipe Book
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe Book
 
Vancouver presentation
Vancouver presentationVancouver presentation
Vancouver presentation
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013
 
Automating Front-End Workflow
Automating Front-End WorkflowAutomating Front-End Workflow
Automating Front-End Workflow
 

Recently uploaded

Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
abh.arya
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
Kamal Acharya
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
ShahidSultan24
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
MuhammadTufail242431
 

Recently uploaded (20)

Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 

Database Schema as Code

  • 1.
  • 2.
  • 4.
  • 5.
  • 6. mysql> create database ridgepole_test
  • 7. gem install –g ridgepole yum install epel-release yum install ruby yum groupinstall "Development Tools“ yum install mysql-devel gem install –g mysql2
  • 8. # vi config.yml development_1: adapter: mysql2 encoding: utf8 host: <%= ENV['MYSQL_HOST'] %> port: 3306 database: ridgepole_test username: root #password: production: ・・・・
  • 9. # vi Schemafile create_table "articles", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| t.string "title", collation: "ascii_bin" t.text "text", null: false, collation: "utf8mb4_bin" t.datetime "created_at" t.datetime "updated_at" end
  • 10. # MYSQL_HOST=10.10.10.11 ridgepole --config config.yml -E development_1 --file Schemafile --apply --dry-run # CREATE TABLE `articles` ( # `id` int(11) auto_increment PRIMARY KEY, # `title` varchar(255), # `text` text NOT NULL, # `created_at` datetime, # `updated_at` datetime) # ENGINE=InnoDB DEFAULT CHARSET=utf8
  • 11. # MYSQL_HOST=10.10.10.11 ridgepole --config config.yml -E development_1 --file Schemafile --apply Apply `schemafile` -- create_table("articles", {:options=>"ENGINE=InnoDB DEFAULT CHARSET=utf8"}) -> 0.0146s cadmin@host1:~ $ mysql -u root -h 10.10.10.11 -D ridgepole_test -e 'show create table articlesG' Table: articles Create Table: CREATE TABLE `articles` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) DEFAULT NULL, `text` text NOT NULL, `created_at` datetime DEFAULT NULL, `updated_at` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8
  • 12. # vi Schemafile create_table "articles", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| t.string "title", null: false collation: "ascii_bin" t.datetime "created_at" t.datetime "updated_at" end
  • 13. # MYSQL_HOST=10.10.10.11 ridgepole --config config.yml -E development_1 --file Schemafile –apply –dry-run # ALTER TABLE `articles` CHANGE `title` `title` varchar(255) NOT NULL # ALTER TABLE `articles` DROP `text` Create Table: CREATE TABLE `articles` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) NOT NULL, `created_at` datetime DEFAULT NULL, `updated_at` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8