diff options
author | Melody Horn <melody@boringcactus.com> | 2021-06-30 16:31:21 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-06-30 16:31:21 -0600 |
commit | bc874c9d1363d3bf8865ea7a629eb976e23386b3 (patch) | |
tree | 17327e9d10acbb198b915592391ef9446c5b4c37 /examples/tutorial02/polls/migrations | |
parent | a4f6e7af6576744e238ecafda826cbe602c23db5 (diff) | |
download | tosin-bc874c9d1363d3bf8865ea7a629eb976e23386b3.tar.gz tosin-bc874c9d1363d3bf8865ea7a629eb976e23386b3.zip |
use the actual path to the app dir for make_migrations
Diffstat (limited to 'examples/tutorial02/polls/migrations')
-rw-r--r-- | examples/tutorial02/polls/migrations/m_0001_auto.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/examples/tutorial02/polls/migrations/m_0001_auto.rs b/examples/tutorial02/polls/migrations/m_0001_auto.rs new file mode 100644 index 0000000..7fa7de0 --- /dev/null +++ b/examples/tutorial02/polls/migrations/m_0001_auto.rs @@ -0,0 +1,34 @@ +use tosin::db::migration::Migration; + +pub const MIGRATION: Migration = Migration { + id: 1usize, + name: "auto", + prereqs: &[], + changes: &[ + DatabaseChange::CreateModel { + name: "Question", + fields: &[ + Field::IntField { name: "id" }, + Field::CharField { + name: "question_text", + max_length: Some(200usize), + }, + Field::DateTimeField { name: "pub_date" }, + ], + options: &[], + }, + DatabaseChange::CreateModel { + name: "Choice", + fields: &[ + Field::IntField { name: "id" }, + Field::IntField { name: "question" }, + Field::CharField { + name: "choice_text", + max_length: Some(200usize), + }, + Field::IntField { name: "votes" }, + ], + options: &[], + }, + ], +}; |