about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-12-09 16:38:09 +0100
committerGitHub <noreply@github.com>2018-12-09 16:38:09 +0100
commitc6b7b984891413cb1db673df2cbea12f8e6f0f05 (patch)
tree46e3982da219f7a5ac34c3aecaf32f0990578d1d /db
parente3682c9c1750e5e7e5d2f817e29f6760a18400ca (diff)
parent4f59d1efd786c08cc63e0c14dceada80c37ab8da (diff)
Merge pull request #849 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
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 4db687137..6e30ed120 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_165847) 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_165847) 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_165847) 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_165847) 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
@@ -649,6 +667,7 @@ ActiveRecord::Schema.define(version: 2018_11_27_165847) 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