My personal project and infrastructure archive
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nomicon/development/libs/barrel/src/tests/pg/reference.rs

19 lines
559 B

#![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");
}