mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Use db schema for tags instead of plugin store and custom fields
This commit is contained in:
27
db/migrate/20160503205953_create_tags.rb
Normal file
27
db/migrate/20160503205953_create_tags.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
class CreateTags < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :tags do |t|
|
||||
t.string :name, null: false
|
||||
t.integer :topic_count, null: false, default: 0
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :topic_tags do |t|
|
||||
t.references :topic, null: false
|
||||
t.references :tag, null: false
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :tag_users do |t|
|
||||
t.references :tag, null: false
|
||||
t.references :user, null: false
|
||||
t.integer :notification_level, null: false
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :tags, :name, unique: true
|
||||
add_index :topic_tags, [:topic_id, :tag_id], unique: true
|
||||
add_index :tag_users, [:user_id, :tag_id, :notification_level], name: "idx_tag_users_ix1", unique: true
|
||||
add_index :tag_users, [:tag_id, :user_id, :notification_level], name: "idx_tag_users_ix2", unique: true
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user