(t *testing.T)
| 293 | } |
| 294 | |
| 295 | func TestForeignKey(t *testing.T) { |
| 296 | store, dom := testkit.CreateMockStoreAndDomain(t) |
| 297 | tk := testkit.NewTestKit(t, store) |
| 298 | tk.MustExec("create table test.t1(a int, b int, c int)") |
| 299 | tk.MustExec("create table test.t2(d int)") |
| 300 | tk.MustExec("create database test2") |
| 301 | tk.MustExec("create table test2.t(e int)") |
| 302 | |
| 303 | is := dom.InfoSchema() |
| 304 | runSQL(t, tk.Session(), is, "ALTER TABLE test.t1 ADD CONSTRAINT fk FOREIGN KEY (a) REFERENCES t2 (d)", false, nil) |
| 305 | |
| 306 | tk.MustExec("use test") |
| 307 | runSQL(t, tk.Session(), is, "ALTER TABLE test.t1 ADD CONSTRAINT fk FOREIGN KEY (b) REFERENCES t2 (d)", false, nil) |
| 308 | runSQL(t, tk.Session(), is, "ALTER TABLE test.t1 ADD CONSTRAINT fk FOREIGN KEY (c) REFERENCES test2.t (e)", false, nil) |
| 309 | } |
| 310 | |
| 311 | func TestDropGlobalTempTable(t *testing.T) { |
| 312 | store := testkit.CreateMockStore(t) |
nothing calls this directly
no test coverage detected