South Cheat Sheet
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

South Cheat Sheet

  • 1,919 views
Uploaded on

South Schema Migration Cheat Sheet

South Schema Migration Cheat Sheet

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,919
On Slideshare
1,899
From Embeds
20
Number of Embeds
1

Actions

Shares
Downloads
15
Comments
0
Likes
0

Embeds 20

http://rafael.adm.br 20

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. South Schema Migration Cheat Sheet (0.5) Initial Import ./manage.py startmigration appname --initial Create Automatic Migration ./manage.py startmigration appname name_of_migration --auto Create a Model ./manage.py startmigration appname create_country --model Country Create a Field ./manage.py startmigration appname add_country_code --add-field Country.code Migration Methods • db.create_table(table_name, fields) • db.delete_table(table_name, cascade=True) • db.rename_table(table_name, new_table_name) • db.clear_table(table_name) • db.add_column(table_name, field_name, field, keep_default=True) • db.delete_column(table_name, column_name) • db.alter_column(table_name, column_name, field, explicit_name=True) • db.rename_column(table_name, column_name, new_column_name) • db.create_index(table_name, column_names, unique=False, db_tablespace=quot;quot;) • db.delete_index(table_name, column_names, db_tablespace=quot;quot;) • db.create_primary_key?(table_name, columns) • db.delete_primary_key?(table_name) • db.create_unique?(table_name, columns) • db.delete_unique?(table_name, columns) • db.execute(sql, params=[]) • db.execute_many(sql) • db.send_create_signal(app_label, model_names) • db.start_transaction?() • db.commit_transaction?() • db.rollback_transaction?() Rafael Lima Working at Myfreecomm Blog: http://rafael.adm.br Podcast: http://rafael.adm.br/voltandopracasa Github: http://github.com/rafaelp Twitter: http://twitter.com/rafaelp