Skip to content

Commit d67f3d1

Browse files
committed
test: assert absence of all foreign-key metadata in ALTER TABLE ADD forms
1 parent d759b08 commit d67f3d1

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎packages/mysql-on-sqlite/tests/WP_MySQL_On_SQLite_Tests.php‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11288,13 +11288,16 @@ public function testInlineReferencesIgnored(): void {
1128811288
$this->assertQuery( 'ALTER TABLE t_alter ADD a INT REFERENCES p (id)' );
1128911289
$this->assertQuery( 'INSERT INTO t_alter (a) VALUES (999)' );
1129011290
$this->assertEquals( array(), $this->assertQuery( "SELECT * FROM information_schema.referential_constraints WHERE table_name = 't_alter'" ) );
11291+
$this->assertEquals( array(), $this->assertQuery( "SELECT * FROM information_schema.table_constraints WHERE table_name = 't_alter'" ) );
11292+
$this->assertEquals( array(), $this->assertQuery( "SELECT * FROM information_schema.key_column_usage WHERE table_name = 't_alter'" ) );
1129111293

1129211294
// Parenthesized ALTER TABLE ADD (...) also ignores inline REFERENCES.
1129311295
$this->assertQuery( 'CREATE TABLE t_alter_paren (id INT)' );
1129411296
$this->assertQuery( 'ALTER TABLE t_alter_paren ADD (a INT REFERENCES p (id))' );
1129511297
$this->assertQuery( 'INSERT INTO t_alter_paren (a) VALUES (999)' );
1129611298
$this->assertEquals( array(), $this->assertQuery( "SELECT * FROM information_schema.referential_constraints WHERE table_name = 't_alter_paren'" ) );
1129711299
$this->assertEquals( array(), $this->assertQuery( "SELECT * FROM information_schema.table_constraints WHERE table_name = 't_alter_paren'" ) );
11300+
$this->assertEquals( array(), $this->assertQuery( "SELECT * FROM information_schema.key_column_usage WHERE table_name = 't_alter_paren'" ) );
1129811301

1129911302
// Explicit table-level FOREIGN KEY constraint still rejects the insert.
1130011303
$this->assertQuery( 'CREATE TABLE t_explicit (id INT, a INT, FOREIGN KEY (a) REFERENCES p (id))' );

0 commit comments

Comments
 (0)