File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -98,9 +98,24 @@ public function copy_subscription_tables()
9898 $ core_push_subscriptions_table => $ wpn_push_subscriptions_table
9999 ] as $ core_table => $ ext_table )
100100 {
101+ // Turn on identity insert on mssql to be able to insert into
102+ // identity columns (e.g. id)
103+ if (strpos ($ this ->db ->sql_layer , 'mssql ' ) !== false )
104+ {
105+ $ sql = 'SET IDENTITY_INSERT ' . $ core_table . ' ON ' ;
106+ $ this ->db ->sql_query ($ sql );
107+ }
108+
101109 $ sql = 'INSERT INTO ' . $ core_table . '
102110 SELECT * FROM ' . $ ext_table ;
103111 $ this ->db ->sql_query ($ sql );
112+
113+ // Disable identity insert on mssql again
114+ if (strpos ($ this ->db ->sql_layer , 'mssql ' ) !== false )
115+ {
116+ $ sql = 'SET IDENTITY_INSERT ' . $ core_table . ' OFF ' ;
117+ $ this ->db ->sql_query ($ sql );
118+ }
104119 }
105120 }
106121}
You can’t perform that action at this time.
0 commit comments