aboutsummaryrefslogtreecommitdiff
path: root/examples/tutorial02/polls/migrations/m_0001_auto.rs
blob: 7fa7de034edb144d0447dec699bcc2d862fb8cdc (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::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: &[],
        },
    ],
};