aboutsummaryrefslogtreecommitdiff
path: root/examples/tutorial02/polls/migrations/m_0001_auto.rs
blob: 2eef04ae5ad4360f9a706a393e8373af8225186d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use tosin::db::migration::{DatabaseChange, Migration};
use tosin::db::models::Field;
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: &[],
        },
    ],
};