bench
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
/** Drop order = reverse of schema create dependency order. */
|
||||
export const TABLES = [
|
||||
'manifestattachment',
|
||||
'file',
|
||||
'companyuser',
|
||||
'syncpos',
|
||||
'companysetting',
|
||||
@@ -48,10 +50,12 @@ export const PROCEDURES = [
|
||||
|
||||
export const VIEWS = ['v_entity_company_number'];
|
||||
|
||||
/** Drop before tables — breaks company ↔ customergroup cycle for purge. */
|
||||
/** Drop before tables — drops all foreign keys so all tables can be purged safely. */
|
||||
export const CONSTRAINTS = [
|
||||
`IF EXISTS (SELECT 1 FROM sys.foreign_keys WHERE name = N'FK_company_poscustomergroup')
|
||||
ALTER TABLE company DROP CONSTRAINT FK_company_poscustomergroup;`,
|
||||
`DECLARE @dropFkSql NVARCHAR(MAX) = N'';
|
||||
SELECT @dropFkSql += N'ALTER TABLE ' + QUOTENAME(OBJECT_SCHEMA_NAME(parent_object_id)) + N'.' + QUOTENAME(OBJECT_NAME(parent_object_id)) + N' DROP CONSTRAINT ' + QUOTENAME(name) + N';'
|
||||
FROM sys.foreign_keys;
|
||||
IF @dropFkSql <> N'' EXEC sp_executesql @dropFkSql;`,
|
||||
];
|
||||
|
||||
export function buildPurgeSql() {
|
||||
|
||||
Reference in New Issue
Block a user