-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathddl.test.res
31 lines (26 loc) · 953 Bytes
/
ddl.test.res
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
/* open DB */
/* open DDL */
/* open Test */
/* let equal = (a: 't, b: 't) => assertion((a, b) => a === b, a, b) */
/* test("create table query", () => { */
/* let result = */
/* createTable(AlbumsTable.table) */
/* ->primaryKey(c => PrimaryKey.make1("PK_Album", c.id)) */
/* ->foreignKeys(c => [ */
/* ForeignKey.make("FK_AlbumArtist", c.artistId, ArtistsTable.table.columns.id), */
/* ]) */
/* ->toSQL */
/* open StringBuilder */
/* let sql = */
/* make() */
/* ->addS("CREATE TABLE albums (") */
/* ->addS(" id INTEGER NOT NULL,") */
/* ->addS(" artistId INTEGER NOT NULL,") */
/* ->addS(" name TEXT NOT NULL,") */
/* ->addS(" year INTEGER NOT NULL,") */
/* ->addS(" CONSTRAINT PK_Album PRIMARY KEY (id),") */
/* ->addS(" CONSTRAINT FK_AlbumArtist FOREIGN KEY (artistId) REFERENCES artists(id)") */
/* ->addS(")") */
/* ->build */
/* equal(result, sql) */
/* }) */