@@ -730,5 +730,33 @@ relocatable = false
730730 const structure = getDirectoryStructure ( svcDeployDir ) ;
731731 expect ( structure ) . toMatchSnapshot ( 'pets-export-svc deploy folder' ) ;
732732 } ) ;
733+
734+ // Behavioral test: columnDefaults columns must be absent from the generated SQL.
735+ // The apis and sites tables have dbname DEFAULT current_database(), which
736+ // captures an environment-specific literal during export. columnDefaults
737+ // strips the column from the INSERT so the DDL default supplies the correct
738+ // value at deploy time (constructive-db commit 348a5b402e).
739+ it ( 'should exclude dbname from apis and sites INSERTs (columnDefaults)' , ( ) => {
740+ const apisSqlPath = join ( exportWorkspaceDir , 'packages' , META_EXTENSION_NAME , 'deploy' , 'migrate' , 'apis.sql' ) ;
741+ const sitesSqlPath = join ( exportWorkspaceDir , 'packages' , META_EXTENSION_NAME , 'deploy' , 'migrate' , 'sites.sql' ) ;
742+
743+ if ( existsSync ( apisSqlPath ) ) {
744+ const apisContent = readFileSync ( apisSqlPath , 'utf-8' ) ;
745+ // dbname must NOT appear — it's stripped by columnDefaults
746+ expect ( apisContent ) . not . toContain ( 'dbname' ) ;
747+ // But other columns should still be present
748+ expect ( apisContent ) . toContain ( 'name' ) ;
749+ expect ( apisContent ) . toContain ( 'is_public' ) ;
750+ }
751+
752+ if ( existsSync ( sitesSqlPath ) ) {
753+ const sitesContent = readFileSync ( sitesSqlPath , 'utf-8' ) ;
754+ // dbname must NOT appear — it's stripped by columnDefaults
755+ expect ( sitesContent ) . not . toContain ( 'dbname' ) ;
756+ // But other columns should still be present
757+ expect ( sitesContent ) . toContain ( 'title' ) ;
758+ expect ( sitesContent ) . toContain ( 'description' ) ;
759+ }
760+ } ) ;
733761 } ) ;
734762} ) ;
0 commit comments