about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-12-06 17:36:11 +0100
committerGitHub <noreply@github.com>2018-12-06 17:36:11 +0100
commit73be8f38c115c279e3d3961b98bd2b82b9706b05 (patch)
treed9b479431676c16580d5e1fa3784cca92d768671 /db
parent155cf126807ab25da4d0e5da55b2d598c981e2ab (diff)
Add profile directory (#9427)
Fix #5578
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20181203003808_create_accounts_tags_join_table.rb8
-rw-r--r--db/migrate/20181203021853_add_discoverable_to_accounts.rb5
-rw-r--r--db/migrate/20181204193439_add_last_status_at_to_account_stats.rb5
-rw-r--r--db/migrate/20181204215309_create_account_tag_stats.rb11
-rw-r--r--db/schema.rb21
5 files changed, 49 insertions, 1 deletions
diff --git a/db/migrate/20181203003808_create_accounts_tags_join_table.rb b/db/migrate/20181203003808_create_accounts_tags_join_table.rb
new file mode 100644
index 000000000..3c275c2b7
--- /dev/null
+++ b/db/migrate/20181203003808_create_accounts_tags_join_table.rb
@@ -0,0 +1,8 @@
+class CreateAccountsTagsJoinTable < ActiveRecord::Migration[5.2]
+  def change
+    create_join_table :accounts, :tags do |t|
+      t.index [:account_id, :tag_id]
+      t.index [:tag_id, :account_id], unique: true
+    end
+  end
+end
diff --git a/db/migrate/20181203021853_add_discoverable_to_accounts.rb b/db/migrate/20181203021853_add_discoverable_to_accounts.rb
new file mode 100644
index 000000000..5bbae2203
--- /dev/null
+++ b/db/migrate/20181203021853_add_discoverable_to_accounts.rb
@@ -0,0 +1,5 @@
+class AddDiscoverableToAccounts < ActiveRecord::Migration[5.2]
+  def change
+    add_column :accounts, :discoverable, :boolean
+  end
+end
diff --git a/db/migrate/20181204193439_add_last_status_at_to_account_stats.rb b/db/migrate/20181204193439_add_last_status_at_to_account_stats.rb
new file mode 100644
index 000000000..946662707
--- /dev/null
+++ b/db/migrate/20181204193439_add_last_status_at_to_account_stats.rb
@@ -0,0 +1,5 @@
+class AddLastStatusAtToAccountStats < ActiveRecord::Migration[5.2]
+  def change
+    add_column :account_stats, :last_status_at, :datetime
+  end
+end
diff --git a/db/migrate/20181204215309_create_account_tag_stats.rb b/db/migrate/20181204215309_create_account_tag_stats.rb
new file mode 100644
index 000000000..15ed8587e
--- /dev/null
+++ b/db/migrate/20181204215309_create_account_tag_stats.rb
@@ -0,0 +1,11 @@
+class CreateAccountTagStats < ActiveRecord::Migration[5.2]
+  def change
+    create_table :account_tag_stats do |t|
+      t.belongs_to :tag, null: false, foreign_key: { on_delete: :cascade }, index: { unique: true }
+      t.bigint :accounts_count, default: 0, null: false
+      t.boolean :hidden, default: false, null: false
+
+      t.timestamps
+    end
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index d67521442..6d643c27c 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
 #
 # It's strongly recommended that you check this file into your version control system.
 
-ActiveRecord::Schema.define(version: 2018_11_27_130500) do
+ActiveRecord::Schema.define(version: 2018_12_04_215309) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"
@@ -63,9 +63,19 @@ ActiveRecord::Schema.define(version: 2018_11_27_130500) do
     t.bigint "followers_count", default: 0, null: false
     t.datetime "created_at", null: false
     t.datetime "updated_at", null: false
+    t.datetime "last_status_at"
     t.index ["account_id"], name: "index_account_stats_on_account_id", unique: true
   end
 
+  create_table "account_tag_stats", force: :cascade do |t|
+    t.bigint "tag_id", null: false
+    t.bigint "accounts_count", default: 0, null: false
+    t.boolean "hidden", default: false, null: false
+    t.datetime "created_at", null: false
+    t.datetime "updated_at", null: false
+    t.index ["tag_id"], name: "index_account_tag_stats_on_tag_id", unique: true
+  end
+
   create_table "accounts", force: :cascade do |t|
     t.string "username", default: "", null: false
     t.string "domain"
@@ -106,6 +116,7 @@ ActiveRecord::Schema.define(version: 2018_11_27_130500) do
     t.string "featured_collection_url"
     t.jsonb "fields"
     t.string "actor_type"
+    t.boolean "discoverable"
     t.index "(((setweight(to_tsvector('simple'::regconfig, (display_name)::text), 'A'::\"char\") || setweight(to_tsvector('simple'::regconfig, (username)::text), 'B'::\"char\")) || setweight(to_tsvector('simple'::regconfig, (COALESCE(domain, ''::character varying))::text), 'C'::\"char\")))", name: "search_index", using: :gin
     t.index "lower((username)::text), lower((domain)::text)", name: "index_accounts_on_username_and_domain_lower", unique: true
     t.index ["moved_to_account_id"], name: "index_accounts_on_moved_to_account_id"
@@ -113,6 +124,13 @@ ActiveRecord::Schema.define(version: 2018_11_27_130500) do
     t.index ["url"], name: "index_accounts_on_url"
   end
 
+  create_table "accounts_tags", id: false, force: :cascade do |t|
+    t.bigint "account_id", null: false
+    t.bigint "tag_id", null: false
+    t.index ["account_id", "tag_id"], name: "index_accounts_tags_on_account_id_and_tag_id"
+    t.index ["tag_id", "account_id"], name: "index_accounts_tags_on_tag_id_and_account_id", unique: true
+  end
+
   create_table "admin_action_logs", force: :cascade do |t|
     t.bigint "account_id"
     t.string "action", default: "", null: false
@@ -637,6 +655,7 @@ ActiveRecord::Schema.define(version: 2018_11_27_130500) do
   add_foreign_key "account_pins", "accounts", column: "target_account_id", on_delete: :cascade
   add_foreign_key "account_pins", "accounts", on_delete: :cascade
   add_foreign_key "account_stats", "accounts", on_delete: :cascade
+  add_foreign_key "account_tag_stats", "tags", on_delete: :cascade
   add_foreign_key "accounts", "accounts", column: "moved_to_account_id", on_delete: :nullify
   add_foreign_key "admin_action_logs", "accounts", on_delete: :cascade
   add_foreign_key "backups", "users", on_delete: :nullify