first( "SELECT 1 AS tbl FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'customer'" ); if ($tableExists) { return; } $database->execute( 'CREATE TABLE customer ( id INT IDENTITY(1,1) NOT NULL, customer_type_id INT NOT NULL, attribute_values NVARCHAR(MAX) NULL, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, CONSTRAINT PK_customer PRIMARY KEY (id), CONSTRAINT FK_customer_customer_type FOREIGN KEY (customer_type_id) REFERENCES customer_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION )' ); $database->execute('CREATE INDEX IX_customer_customer_type_id ON customer (customer_type_id)'); } public function down(Database $database): void { $database->execute('DROP TABLE IF EXISTS customer'); } };