aboutsummaryrefslogtreecommitdiff
path: root/development/libs/barrel/src/tests/pg/reference.rs
blob: 4980e6d7b6013f29e891d31b62690a43dc3ee6cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#![allow(unused_imports)]

use crate::backend::{Pg, SqlGenerator};
use crate::{types, Migration, Table};


#[test]
fn in_schema() {
    let sql = Pg::add_column(false, Some("schema"), "author", &types::foreign("users", "id"));

    assert_eq!(sql, "\"author\" INTEGER REFERENCES \"schema\".\"users\"(id) NOT NULL");
}

#[test]
fn ext_schema() {
    let sql = Pg::add_column(false, Some("schema"), "author", &types::foreign_schema("other_schema", "users", "id"));

    assert_eq!(sql, "\"author\" INTEGER REFERENCES \"other_schema\".\"users\"(id) NOT NULL");
}