SlideShare a Scribd company logo
from django.db import models
class Person(models.Model):
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)
CREATE TABLE myapp_person (
"id" serial NOT NULL PRIMARY KEY,
"first_name" varchar(30) NOT NULL,
"last_name" varchar(30) NOT NULL
);
class Migration(migrations.Migration):
initial = True
dependencies = [ ]
operations = [
migrations.CreateModel(
name='SampleModel1',
fields=[
('id', models.AutoField(auto_created=True,
primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200)),
],
),
]
$ ./manage.py sqlmigrate app1 0001
BEGIN;
--
-- Create model SampleModel1
--
CREATE TABLE `app1_samplemodel1` (`id` integer
AUTO_INCREMENT NOT NULL PRIMARY KEY, `name` varchar(200) NOT
NULL);
COMMIT;
$ ./manage.py migrate
Operations to perform:
Apply all migrations: admin, app1, auth,
contenttypes, sessions
Running migrations:
Applying app1.0001_initial... OK
id app name applied
12 auth
0008_alter_user_usernam
e_max_length
2017-03-31 05:02:26.307972
13 sessions 0001_initial 2017-03-31 05:02:26.361356
14 app1 0001_initial 2017-03-31 05:29:31.189362
$ python manage.py reset_db
You have requested a database reset.
This will IRREVERSIBLY DESTROY
ALL data in the database "migrations_demo".
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes
Reset successful.
$ python manage.py showmigrations
admin
[X] 0001_initial
[X] 0002_logentry_remove_auto_add
app1
[X] 0001_initial
auth
[X] 0001_initial
[X] 0002_alter_permission_name_max_length
[X] 0003_alter_user_email_max_length
[X] 0004_alter_user_username_opts
[X] 0005_alter_user_last_login_null
[X] 0006_require_contenttypes_0002
[X] 0007_alter_validators_add_error_messages
[X] 0008_alter_user_username_max_length
contenttypes
[X] 0001_initial
[X] 0002_remove_content_type_name
sessions
[X] 0001_initial
djangoのmigrationはどう動いているか
djangoのmigrationはどう動いているか

More Related Content

What's hot

CS 151 Classes lecture 2
CS 151 Classes lecture 2CS 151 Classes lecture 2
CS 151 Classes lecture 2
Rudy Martinez
 
Structure
StructureStructure
Structure
Deepak Sahu
 
Автотесты для картинок
Автотесты для картинокАвтотесты для картинок
Автотесты для картинок
Petr Trofimov
 
[KOSSA] C++ Programming - 17th Study - STL #3
[KOSSA] C++ Programming - 17th Study - STL #3[KOSSA] C++ Programming - 17th Study - STL #3
[KOSSA] C++ Programming - 17th Study - STL #3
Seok-joon Yun
 
Rediscovering JavaScript: The Language Behind The Libraries
Rediscovering JavaScript: The Language Behind The LibrariesRediscovering JavaScript: The Language Behind The Libraries
Rediscovering JavaScript: The Language Behind The Libraries
Simon Willison
 
1
11
Sql commands
Sql commandsSql commands
Sql commands
shweta-sharma99
 
How to count money using PHP and not lose money
How to count money using PHP and not lose moneyHow to count money using PHP and not lose money
How to count money using PHP and not lose money
Piotr Horzycki
 
dotnetConf2019 meetup in AICHI / Elmish
dotnetConf2019 meetup in AICHI / ElmishdotnetConf2019 meetup in AICHI / Elmish
dotnetConf2019 meetup in AICHI / Elmish
Midoliy
 
An Elephant of a Different Colour: Hack
An Elephant of a Different Colour: HackAn Elephant of a Different Colour: Hack
An Elephant of a Different Colour: Hack
Vic Metcalfe
 
Answer2 (clothing boutique)
Answer2 (clothing boutique)Answer2 (clothing boutique)
Answer2 (clothing boutique)
Nicky Valdo
 
CreacióN Tablas En Oracle
CreacióN Tablas En OracleCreacióN Tablas En Oracle
CreacióN Tablas En Oracle
esacre
 
11. delete record
11. delete record11. delete record
11. delete record
Razvan Raducanu, PhD
 
10. view one record
10. view one record10. view one record
10. view one record
Razvan Raducanu, PhD
 
Migrations In3 Mins
Migrations In3 MinsMigrations In3 Mins
Migrations In3 Mins
hiremaga
 
Creating custom views
Creating custom viewsCreating custom views
Creating custom views
Mu Chun Wang
 
linieaire regressie
linieaire regressielinieaire regressie
linieaire regressie
Mwalima Peltenburg
 
WordPress 3.1 at DC PHP
WordPress 3.1 at DC PHPWordPress 3.1 at DC PHP
WordPress 3.1 at DC PHP
andrewnacin
 
Htmlgraficcode
HtmlgraficcodeHtmlgraficcode
Htmlgraficcode
marco fuenzalida
 
WordCamp Geneva Presentation - Customising WordPress' Admin Panel - 19 Nov. 2016
WordCamp Geneva Presentation - Customising WordPress' Admin Panel - 19 Nov. 2016WordCamp Geneva Presentation - Customising WordPress' Admin Panel - 19 Nov. 2016
WordCamp Geneva Presentation - Customising WordPress' Admin Panel - 19 Nov. 2016
Jesper van Engelen
 

What's hot (20)

CS 151 Classes lecture 2
CS 151 Classes lecture 2CS 151 Classes lecture 2
CS 151 Classes lecture 2
 
Structure
StructureStructure
Structure
 
Автотесты для картинок
Автотесты для картинокАвтотесты для картинок
Автотесты для картинок
 
[KOSSA] C++ Programming - 17th Study - STL #3
[KOSSA] C++ Programming - 17th Study - STL #3[KOSSA] C++ Programming - 17th Study - STL #3
[KOSSA] C++ Programming - 17th Study - STL #3
 
Rediscovering JavaScript: The Language Behind The Libraries
Rediscovering JavaScript: The Language Behind The LibrariesRediscovering JavaScript: The Language Behind The Libraries
Rediscovering JavaScript: The Language Behind The Libraries
 
1
11
1
 
Sql commands
Sql commandsSql commands
Sql commands
 
How to count money using PHP and not lose money
How to count money using PHP and not lose moneyHow to count money using PHP and not lose money
How to count money using PHP and not lose money
 
dotnetConf2019 meetup in AICHI / Elmish
dotnetConf2019 meetup in AICHI / ElmishdotnetConf2019 meetup in AICHI / Elmish
dotnetConf2019 meetup in AICHI / Elmish
 
An Elephant of a Different Colour: Hack
An Elephant of a Different Colour: HackAn Elephant of a Different Colour: Hack
An Elephant of a Different Colour: Hack
 
Answer2 (clothing boutique)
Answer2 (clothing boutique)Answer2 (clothing boutique)
Answer2 (clothing boutique)
 
CreacióN Tablas En Oracle
CreacióN Tablas En OracleCreacióN Tablas En Oracle
CreacióN Tablas En Oracle
 
11. delete record
11. delete record11. delete record
11. delete record
 
10. view one record
10. view one record10. view one record
10. view one record
 
Migrations In3 Mins
Migrations In3 MinsMigrations In3 Mins
Migrations In3 Mins
 
Creating custom views
Creating custom viewsCreating custom views
Creating custom views
 
linieaire regressie
linieaire regressielinieaire regressie
linieaire regressie
 
WordPress 3.1 at DC PHP
WordPress 3.1 at DC PHPWordPress 3.1 at DC PHP
WordPress 3.1 at DC PHP
 
Htmlgraficcode
HtmlgraficcodeHtmlgraficcode
Htmlgraficcode
 
WordCamp Geneva Presentation - Customising WordPress' Admin Panel - 19 Nov. 2016
WordCamp Geneva Presentation - Customising WordPress' Admin Panel - 19 Nov. 2016WordCamp Geneva Presentation - Customising WordPress' Admin Panel - 19 Nov. 2016
WordCamp Geneva Presentation - Customising WordPress' Admin Panel - 19 Nov. 2016
 

Similar to djangoのmigrationはどう動いているか

Lo nuevo de Django 1.7 y 1.8
Lo nuevo de Django 1.7 y 1.8Lo nuevo de Django 1.7 y 1.8
Lo nuevo de Django 1.7 y 1.8
pedroburonv
 
날로 먹는 Django admin 활용
날로 먹는 Django admin 활용날로 먹는 Django admin 활용
날로 먹는 Django admin 활용
KyeongMook "Kay" Cha
 
The Ring programming language version 1.5.2 book - Part 43 of 181
The Ring programming language version 1.5.2 book - Part 43 of 181The Ring programming language version 1.5.2 book - Part 43 of 181
The Ring programming language version 1.5.2 book - Part 43 of 181
Mahmoud Samir Fayed
 
include ltstdiohgt include ltstringhgt define M.pdf
include ltstdiohgt include ltstringhgt define M.pdfinclude ltstdiohgt include ltstringhgt define M.pdf
include ltstdiohgt include ltstringhgt define M.pdf
adisainternational
 
Jython: Python para la plataforma Java (JRSL 09)
Jython: Python para la plataforma Java (JRSL 09)Jython: Python para la plataforma Java (JRSL 09)
Jython: Python para la plataforma Java (JRSL 09)
Leonardo Soto
 
파이썬 플라스크로 배우는 웹프로그래밍 #4 (ABCD)
파이썬 플라스크로 배우는 웹프로그래밍 #4 (ABCD)파이썬 플라스크로 배우는 웹프로그래밍 #4 (ABCD)
파이썬 플라스크로 배우는 웹프로그래밍 #4 (ABCD)
성일 한
 
Assignment 6.1.pdf
Assignment 6.1.pdfAssignment 6.1.pdf
Assignment 6.1.pdf
dash41
 
Jython: Python para la plataforma Java (EL2009)
Jython: Python para la plataforma Java (EL2009)Jython: Python para la plataforma Java (EL2009)
Jython: Python para la plataforma Java (EL2009)
Leonardo Soto
 
Django - sql alchemy - jquery
Django - sql alchemy - jqueryDjango - sql alchemy - jquery
Django - sql alchemy - jquery
Mohammed El Rafie Tarabay
 
Django Admin: Widgetry & Witchery
Django Admin: Widgetry & WitcheryDjango Admin: Widgetry & Witchery
Django Admin: Widgetry & Witchery
Pamela Fox
 
The Ring programming language version 1.2 book - Part 32 of 84
The Ring programming language version 1.2 book - Part 32 of 84The Ring programming language version 1.2 book - Part 32 of 84
The Ring programming language version 1.2 book - Part 32 of 84
Mahmoud Samir Fayed
 
Pruebas unitarias con django
Pruebas unitarias con djangoPruebas unitarias con django
Pruebas unitarias con django
Tomás Henríquez
 
Bottle, o full stack sem Django
Bottle, o full stack sem DjangoBottle, o full stack sem Django
Bottle, o full stack sem Django
Thiago Avelino
 
Below is a Password Management Program incl.pdf
Below is a Password Management Program                 incl.pdfBelow is a Password Management Program                 incl.pdf
Below is a Password Management Program incl.pdf
abiagencymadurai
 
Django tutorial 2009
Django tutorial 2009Django tutorial 2009
Django tutorial 2009
Ferenc Szalai
 
Epic South Disasters
Epic South DisastersEpic South Disasters
Epic South Disasters
Christopher Adams
 
The Ring programming language version 1.10 book - Part 54 of 212
The Ring programming language version 1.10 book - Part 54 of 212The Ring programming language version 1.10 book - Part 54 of 212
The Ring programming language version 1.10 book - Part 54 of 212
Mahmoud Samir Fayed
 
Can someone please explain what the code below is doing and comment on.pdf
Can someone please explain what the code below is doing and comment on.pdfCan someone please explain what the code below is doing and comment on.pdf
Can someone please explain what the code below is doing and comment on.pdf
kuldeepkumarapgsi
 
Structure
StructureStructure
Structure
Sara Sahu
 
Intro programacion funcional
Intro programacion funcionalIntro programacion funcional
Intro programacion funcional
NSCoder Mexico
 

Similar to djangoのmigrationはどう動いているか (20)

Lo nuevo de Django 1.7 y 1.8
Lo nuevo de Django 1.7 y 1.8Lo nuevo de Django 1.7 y 1.8
Lo nuevo de Django 1.7 y 1.8
 
날로 먹는 Django admin 활용
날로 먹는 Django admin 활용날로 먹는 Django admin 활용
날로 먹는 Django admin 활용
 
The Ring programming language version 1.5.2 book - Part 43 of 181
The Ring programming language version 1.5.2 book - Part 43 of 181The Ring programming language version 1.5.2 book - Part 43 of 181
The Ring programming language version 1.5.2 book - Part 43 of 181
 
include ltstdiohgt include ltstringhgt define M.pdf
include ltstdiohgt include ltstringhgt define M.pdfinclude ltstdiohgt include ltstringhgt define M.pdf
include ltstdiohgt include ltstringhgt define M.pdf
 
Jython: Python para la plataforma Java (JRSL 09)
Jython: Python para la plataforma Java (JRSL 09)Jython: Python para la plataforma Java (JRSL 09)
Jython: Python para la plataforma Java (JRSL 09)
 
파이썬 플라스크로 배우는 웹프로그래밍 #4 (ABCD)
파이썬 플라스크로 배우는 웹프로그래밍 #4 (ABCD)파이썬 플라스크로 배우는 웹프로그래밍 #4 (ABCD)
파이썬 플라스크로 배우는 웹프로그래밍 #4 (ABCD)
 
Assignment 6.1.pdf
Assignment 6.1.pdfAssignment 6.1.pdf
Assignment 6.1.pdf
 
Jython: Python para la plataforma Java (EL2009)
Jython: Python para la plataforma Java (EL2009)Jython: Python para la plataforma Java (EL2009)
Jython: Python para la plataforma Java (EL2009)
 
Django - sql alchemy - jquery
Django - sql alchemy - jqueryDjango - sql alchemy - jquery
Django - sql alchemy - jquery
 
Django Admin: Widgetry & Witchery
Django Admin: Widgetry & WitcheryDjango Admin: Widgetry & Witchery
Django Admin: Widgetry & Witchery
 
The Ring programming language version 1.2 book - Part 32 of 84
The Ring programming language version 1.2 book - Part 32 of 84The Ring programming language version 1.2 book - Part 32 of 84
The Ring programming language version 1.2 book - Part 32 of 84
 
Pruebas unitarias con django
Pruebas unitarias con djangoPruebas unitarias con django
Pruebas unitarias con django
 
Bottle, o full stack sem Django
Bottle, o full stack sem DjangoBottle, o full stack sem Django
Bottle, o full stack sem Django
 
Below is a Password Management Program incl.pdf
Below is a Password Management Program                 incl.pdfBelow is a Password Management Program                 incl.pdf
Below is a Password Management Program incl.pdf
 
Django tutorial 2009
Django tutorial 2009Django tutorial 2009
Django tutorial 2009
 
Epic South Disasters
Epic South DisastersEpic South Disasters
Epic South Disasters
 
The Ring programming language version 1.10 book - Part 54 of 212
The Ring programming language version 1.10 book - Part 54 of 212The Ring programming language version 1.10 book - Part 54 of 212
The Ring programming language version 1.10 book - Part 54 of 212
 
Can someone please explain what the code below is doing and comment on.pdf
Can someone please explain what the code below is doing and comment on.pdfCan someone please explain what the code below is doing and comment on.pdf
Can someone please explain what the code below is doing and comment on.pdf
 
Structure
StructureStructure
Structure
 
Intro programacion funcional
Intro programacion funcionalIntro programacion funcional
Intro programacion funcional
 

More from Xoxzo Inc.

人間のためのpython #stapy68 2021-04-14
人間のためのpython #stapy68 2021-04-14人間のためのpython #stapy68 2021-04-14
人間のためのpython #stapy68 2021-04-14
Xoxzo Inc.
 
Goto statement considered harmful - LearnDay@Xoxzo #17
Goto statement considered harmful - LearnDay@Xoxzo #17Goto statement considered harmful - LearnDay@Xoxzo #17
Goto statement considered harmful - LearnDay@Xoxzo #17
Xoxzo Inc.
 
A very short history on drunkenness - LearnDay@Xoxzo #14
A very short history on drunkenness - LearnDay@Xoxzo #14A very short history on drunkenness - LearnDay@Xoxzo #14
A very short history on drunkenness - LearnDay@Xoxzo #14
Xoxzo Inc.
 
PyCon JP 2019 LT - 「ありがとう」と言おう
PyCon JP 2019 LT - 「ありがとう」と言おうPyCon JP 2019 LT - 「ありがとう」と言おう
PyCon JP 2019 LT - 「ありがとう」と言おう
Xoxzo Inc.
 
USB Hacking - LearnDay@Xoxzo #11
USB Hacking -  LearnDay@Xoxzo #11USB Hacking -  LearnDay@Xoxzo #11
USB Hacking - LearnDay@Xoxzo #11
Xoxzo Inc.
 
How to run a design sprint - LearnDay@Xoxzo #9
How to run a design sprint - LearnDay@Xoxzo #9How to run a design sprint - LearnDay@Xoxzo #9
How to run a design sprint - LearnDay@Xoxzo #9
Xoxzo Inc.
 
Lightning Talk: PyCon Thailand 2019
Lightning Talk: PyCon Thailand 2019Lightning Talk: PyCon Thailand 2019
Lightning Talk: PyCon Thailand 2019
Xoxzo Inc.
 
The Culture Map - LearnDay@Xoxzo #8
The Culture Map - LearnDay@Xoxzo #8The Culture Map - LearnDay@Xoxzo #8
The Culture Map - LearnDay@Xoxzo #8
Xoxzo Inc.
 
Linear algebra power of abstraction - LearnDay@Xoxzo #5
Linear algebra power of abstraction - LearnDay@Xoxzo #5Linear algebra power of abstraction - LearnDay@Xoxzo #5
Linear algebra power of abstraction - LearnDay@Xoxzo #5
Xoxzo Inc.
 
The Takumi Method - LearnDay@Xoxzo #1
The Takumi Method - LearnDay@Xoxzo #1The Takumi Method - LearnDay@Xoxzo #1
The Takumi Method - LearnDay@Xoxzo #1
Xoxzo Inc.
 
Django osc2018-okinawa
Django osc2018-okinawaDjango osc2018-okinawa
Django osc2018-okinawa
Xoxzo Inc.
 
多要素認証やSMSマーケティングを支えるテレフォニーAPI活用入門
多要素認証やSMSマーケティングを支えるテレフォニーAPI活用入門多要素認証やSMSマーケティングを支えるテレフォニーAPI活用入門
多要素認証やSMSマーケティングを支えるテレフォニーAPI活用入門
Xoxzo Inc.
 
Working in a Fully Remote Organization: Challenges and How We Made it Work - ...
Working in a Fully Remote Organization: Challenges and How We Made it Work - ...Working in a Fully Remote Organization: Challenges and How We Made it Work - ...
Working in a Fully Remote Organization: Challenges and How We Made it Work - ...
Xoxzo Inc.
 
JomLaunch 5.0 Sep 2017 by Iqbal Abdullah
JomLaunch 5.0 Sep 2017 by Iqbal AbdullahJomLaunch 5.0 Sep 2017 by Iqbal Abdullah
JomLaunch 5.0 Sep 2017 by Iqbal Abdullah
Xoxzo Inc.
 
Introduction to Data Analysis
Introduction to Data AnalysisIntroduction to Data Analysis
Introduction to Data Analysis
Xoxzo Inc.
 
XoxzoテレフォニーAPI入門2017
XoxzoテレフォニーAPI入門2017XoxzoテレフォニーAPI入門2017
XoxzoテレフォニーAPI入門2017
Xoxzo Inc.
 
初心者のためのPythonによるWebAPI活用方入門
初心者のためのPythonによるWebAPI活用方入門初心者のためのPythonによるWebAPI活用方入門
初心者のためのPythonによるWebAPI活用方入門
Xoxzo Inc.
 
PyCon APAC 2017
PyCon APAC 2017PyCon APAC 2017
PyCon APAC 2017
Xoxzo Inc.
 
Pythonの隠れた武器
Pythonの隠れた武器Pythonの隠れた武器
Pythonの隠れた武器
Xoxzo Inc.
 
The Secret Weapon Of Python
The Secret Weapon Of PythonThe Secret Weapon Of Python
The Secret Weapon Of Python
Xoxzo Inc.
 

More from Xoxzo Inc. (20)

人間のためのpython #stapy68 2021-04-14
人間のためのpython #stapy68 2021-04-14人間のためのpython #stapy68 2021-04-14
人間のためのpython #stapy68 2021-04-14
 
Goto statement considered harmful - LearnDay@Xoxzo #17
Goto statement considered harmful - LearnDay@Xoxzo #17Goto statement considered harmful - LearnDay@Xoxzo #17
Goto statement considered harmful - LearnDay@Xoxzo #17
 
A very short history on drunkenness - LearnDay@Xoxzo #14
A very short history on drunkenness - LearnDay@Xoxzo #14A very short history on drunkenness - LearnDay@Xoxzo #14
A very short history on drunkenness - LearnDay@Xoxzo #14
 
PyCon JP 2019 LT - 「ありがとう」と言おう
PyCon JP 2019 LT - 「ありがとう」と言おうPyCon JP 2019 LT - 「ありがとう」と言おう
PyCon JP 2019 LT - 「ありがとう」と言おう
 
USB Hacking - LearnDay@Xoxzo #11
USB Hacking -  LearnDay@Xoxzo #11USB Hacking -  LearnDay@Xoxzo #11
USB Hacking - LearnDay@Xoxzo #11
 
How to run a design sprint - LearnDay@Xoxzo #9
How to run a design sprint - LearnDay@Xoxzo #9How to run a design sprint - LearnDay@Xoxzo #9
How to run a design sprint - LearnDay@Xoxzo #9
 
Lightning Talk: PyCon Thailand 2019
Lightning Talk: PyCon Thailand 2019Lightning Talk: PyCon Thailand 2019
Lightning Talk: PyCon Thailand 2019
 
The Culture Map - LearnDay@Xoxzo #8
The Culture Map - LearnDay@Xoxzo #8The Culture Map - LearnDay@Xoxzo #8
The Culture Map - LearnDay@Xoxzo #8
 
Linear algebra power of abstraction - LearnDay@Xoxzo #5
Linear algebra power of abstraction - LearnDay@Xoxzo #5Linear algebra power of abstraction - LearnDay@Xoxzo #5
Linear algebra power of abstraction - LearnDay@Xoxzo #5
 
The Takumi Method - LearnDay@Xoxzo #1
The Takumi Method - LearnDay@Xoxzo #1The Takumi Method - LearnDay@Xoxzo #1
The Takumi Method - LearnDay@Xoxzo #1
 
Django osc2018-okinawa
Django osc2018-okinawaDjango osc2018-okinawa
Django osc2018-okinawa
 
多要素認証やSMSマーケティングを支えるテレフォニーAPI活用入門
多要素認証やSMSマーケティングを支えるテレフォニーAPI活用入門多要素認証やSMSマーケティングを支えるテレフォニーAPI活用入門
多要素認証やSMSマーケティングを支えるテレフォニーAPI活用入門
 
Working in a Fully Remote Organization: Challenges and How We Made it Work - ...
Working in a Fully Remote Organization: Challenges and How We Made it Work - ...Working in a Fully Remote Organization: Challenges and How We Made it Work - ...
Working in a Fully Remote Organization: Challenges and How We Made it Work - ...
 
JomLaunch 5.0 Sep 2017 by Iqbal Abdullah
JomLaunch 5.0 Sep 2017 by Iqbal AbdullahJomLaunch 5.0 Sep 2017 by Iqbal Abdullah
JomLaunch 5.0 Sep 2017 by Iqbal Abdullah
 
Introduction to Data Analysis
Introduction to Data AnalysisIntroduction to Data Analysis
Introduction to Data Analysis
 
XoxzoテレフォニーAPI入門2017
XoxzoテレフォニーAPI入門2017XoxzoテレフォニーAPI入門2017
XoxzoテレフォニーAPI入門2017
 
初心者のためのPythonによるWebAPI活用方入門
初心者のためのPythonによるWebAPI活用方入門初心者のためのPythonによるWebAPI活用方入門
初心者のためのPythonによるWebAPI活用方入門
 
PyCon APAC 2017
PyCon APAC 2017PyCon APAC 2017
PyCon APAC 2017
 
Pythonの隠れた武器
Pythonの隠れた武器Pythonの隠れた武器
Pythonの隠れた武器
 
The Secret Weapon Of Python
The Secret Weapon Of PythonThe Secret Weapon Of Python
The Secret Weapon Of Python
 

Recently uploaded

LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Envertis Software Solutions
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Undress Baby
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 

Recently uploaded (20)

LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 

djangoのmigrationはどう動いているか

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18. from django.db import models class Person(models.Model): first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=30)
  • 19. CREATE TABLE myapp_person ( "id" serial NOT NULL PRIMARY KEY, "first_name" varchar(30) NOT NULL, "last_name" varchar(30) NOT NULL );
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30. class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='SampleModel1', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=200)), ], ), ]
  • 31. $ ./manage.py sqlmigrate app1 0001 BEGIN; -- -- Create model SampleModel1 -- CREATE TABLE `app1_samplemodel1` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `name` varchar(200) NOT NULL); COMMIT;
  • 32.
  • 33.
  • 34.
  • 35. $ ./manage.py migrate Operations to perform: Apply all migrations: admin, app1, auth, contenttypes, sessions Running migrations: Applying app1.0001_initial... OK
  • 36. id app name applied 12 auth 0008_alter_user_usernam e_max_length 2017-03-31 05:02:26.307972 13 sessions 0001_initial 2017-03-31 05:02:26.361356 14 app1 0001_initial 2017-03-31 05:29:31.189362
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45. $ python manage.py reset_db You have requested a database reset. This will IRREVERSIBLY DESTROY ALL data in the database "migrations_demo". Are you sure you want to do this? Type 'yes' to continue, or 'no' to cancel: yes Reset successful.
  • 46.
  • 47.
  • 48. $ python manage.py showmigrations admin [X] 0001_initial [X] 0002_logentry_remove_auto_add app1 [X] 0001_initial auth [X] 0001_initial [X] 0002_alter_permission_name_max_length [X] 0003_alter_user_email_max_length [X] 0004_alter_user_username_opts [X] 0005_alter_user_last_login_null [X] 0006_require_contenttypes_0002 [X] 0007_alter_validators_add_error_messages [X] 0008_alter_user_username_max_length contenttypes [X] 0001_initial [X] 0002_remove_content_type_name sessions [X] 0001_initial