Browse Source

Maintenance: Drop unused templates_groups table.

Martin Gruner 8 months ago
parent
commit
c9bf2939f2

+ 0 - 10
db/migrate/20120101000010_create_ticket.rb

@@ -405,15 +405,6 @@ class CreateTicket < ActiveRecord::Migration[4.2]
     add_foreign_key :templates, :users, column: :created_by_id
     add_foreign_key :templates, :users, column: :updated_by_id
 
-    create_table :templates_groups, id: false do |t|
-      t.references :template
-      t.references :group
-    end
-    add_index :templates_groups, [:template_id]
-    add_index :templates_groups, [:group_id]
-    add_foreign_key :templates_groups, :templates
-    add_foreign_key :templates_groups, :groups
-
     create_table :channels do |t|
       t.references :group,                             null: true
       t.column :area,           :string, limit: 100,   null: false
@@ -582,7 +573,6 @@ class CreateTicket < ActiveRecord::Migration[4.2]
     drop_table :macros
     drop_table :slas
     drop_table :channels
-    drop_table :templates_groups
     drop_table :templates
     drop_table :text_modules_groups
     drop_table :text_modules

+ 10 - 0
db/migrate/20240618074549_drop_templates_groups_table.rb

@@ -0,0 +1,10 @@
+# Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
+
+class DropTemplatesGroupsTable < ActiveRecord::Migration[7.0]
+  def change
+    # return if it's a new setup
+    return if !Setting.exists?(name: 'system_init_done')
+
+    drop_table :templates_groups
+  end
+end