-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
73 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
use crate::M; | ||
|
||
pub fn m_valid0() -> M<'static> { | ||
M::up("CREATE TABLE m1(a, b); CREATE TABLE m2(a, b, c);") | ||
} | ||
pub fn m_valid10() -> M<'static> { | ||
M::up("CREATE TABLE t1(a, b);") | ||
} | ||
pub fn m_valid11() -> M<'static> { | ||
M::up("ALTER TABLE t1 RENAME COLUMN b TO c;") | ||
} | ||
pub fn m_valid20() -> M<'static> { | ||
M::up("CREATE TABLE t2(b);") | ||
} | ||
pub fn m_valid21() -> M<'static> { | ||
M::up("ALTER TABLE t2 ADD COLUMN a;") | ||
} | ||
|
||
pub fn m_valid_fk() -> M<'static> { | ||
M::up( | ||
"CREATE TABLE fk1(a PRIMARY KEY); \ | ||
CREATE TABLE fk2( \ | ||
a, \ | ||
FOREIGN KEY(a) REFERENCES fk1(a) \ | ||
); \ | ||
INSERT INTO fk1 (a) VALUES ('foo'); \ | ||
INSERT INTO fk2 (a) VALUES ('foo'); \ | ||
", | ||
) | ||
.foreign_key_check() | ||
} | ||
|
||
// All valid Ms in the right order | ||
pub fn all_valid() -> Vec<M<'static>> { | ||
vec![ | ||
m_valid0(), | ||
m_valid10(), | ||
m_valid11(), | ||
m_valid20(), | ||
m_valid21(), | ||
m_valid_fk(), | ||
] | ||
} | ||
|
||
pub fn m_invalid0() -> M<'static> { | ||
M::up("CREATE TABLE table3()") | ||
} | ||
pub fn m_invalid1() -> M<'static> { | ||
M::up("something invalid") | ||
} | ||
|
||
pub fn m_invalid_fk() -> M<'static> { | ||
M::up( | ||
"CREATE TABLE fk1(a PRIMARY KEY); \ | ||
CREATE TABLE fk2( \ | ||
a, \ | ||
FOREIGN KEY(a) REFERENCES fk1(a) \ | ||
); \ | ||
INSERT INTO fk2 (a) VALUES ('foo'); \ | ||
", | ||
) | ||
.foreign_key_check() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
mod asynch; | ||
mod builder; | ||
mod helpers; | ||
mod synch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters