Alembic: Difference between revisions

From 탱이의 잡동사니
Jump to navigation Jump to search
No edit summary
Line 9: Line 9:


=== Example ===
=== Example ===
</pre>
<pre>
$ alembic -c config.ini revision -m "increse_reg_server_size"
$ alembic -c config.ini revision -m "increse_reg_server_size"
   Generating /home/pchero/gittmp/asterisk/contrib/ast-db-manage/config/versions/1ae0609b6646_increse_reg_server_size.py ...  done
   Generating /home/pchero/gittmp/asterisk/contrib/ast-db-manage/config/versions/1ae0609b6646_increse_reg_server_size.py ...  done
<pre>
</pre>


== Example ==
== Example ==

Revision as of 12:38, 31 August 2020

Overview

SQLAlchemy based database migration tool alembic 내용 정리

Add revision

alembic revision 을 사용하면 새로운 변경사항을 추가할 수 있다.

$ alembic -c config.ini revision -m "increse_reg_server_size" 

Example

$ alembic -c config.ini revision -m "increse_reg_server_size"
  Generating /home/pchero/gittmp/asterisk/contrib/ast-db-manage/config/versions/1ae0609b6646_increse_reg_server_size.py ...  done

Example

<source lang=bash> $ alembic init myproject

 Creating directory /home/pchero/github/etc_examples/alembic_example/simple_test/myproject ...  done
 Creating directory /home/pchero/github/etc_examples/alembic_example/simple_test/myproject/versions ...  done
 Generating /home/pchero/github/etc_examples/alembic_example/simple_test/myproject/env.py ...  done
 Generating /home/pchero/github/etc_examples/alembic_example/simple_test/myproject/script.py.mako ...  done
 Generating /home/pchero/github/etc_examples/alembic_example/simple_test/myproject/README ...  done
 Generating /home/pchero/github/etc_examples/alembic_example/simple_test/alembic.ini ...  done
 Please edit configuration/connection/logging settings in '/home/pchero/github/etc_examples/alembic_example/simple_test/alembic.ini' before proceeding.

$ tree . . ├── alembic.ini └── myproject

   ├── env.py
   ├── README
   ├── script.py.mako
   └── versions

</source>

See also