diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20220824233535_create_status_trends.rb | 12 | ||||
-rw-r--r-- | db/migrate/20221006061337_create_preview_card_trends.rb | 11 | ||||
-rw-r--r-- | db/schema.rb | 25 |
3 files changed, 47 insertions, 1 deletions
diff --git a/db/migrate/20220824233535_create_status_trends.rb b/db/migrate/20220824233535_create_status_trends.rb new file mode 100644 index 000000000..cea0abf35 --- /dev/null +++ b/db/migrate/20220824233535_create_status_trends.rb @@ -0,0 +1,12 @@ +class CreateStatusTrends < ActiveRecord::Migration[6.1] + def change + create_table :status_trends do |t| + t.references :status, null: false, foreign_key: { on_delete: :cascade }, index: { unique: true } + t.references :account, null: false, foreign_key: { on_delete: :cascade } + t.float :score, null: false, default: 0 + t.integer :rank, null: false, default: 0 + t.boolean :allowed, null: false, default: false + t.string :language + end + end +end diff --git a/db/migrate/20221006061337_create_preview_card_trends.rb b/db/migrate/20221006061337_create_preview_card_trends.rb new file mode 100644 index 000000000..baad9c31c --- /dev/null +++ b/db/migrate/20221006061337_create_preview_card_trends.rb @@ -0,0 +1,11 @@ +class CreatePreviewCardTrends < ActiveRecord::Migration[6.1] + def change + create_table :preview_card_trends do |t| + t.references :preview_card, null: false, foreign_key: { on_delete: :cascade }, index: { unique: true } + t.float :score, null: false, default: 0 + t.integer :rank, null: false, default: 0 + t.boolean :allowed, null: false, default: false + t.string :language + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 1a98b22db..2f9058509 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: 2022_08_29_192658) do +ActiveRecord::Schema.define(version: 2022_10_06_061337) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -735,6 +735,15 @@ ActiveRecord::Schema.define(version: 2022_08_29_192658) do t.index ["domain"], name: "index_preview_card_providers_on_domain", unique: true end + create_table "preview_card_trends", force: :cascade do |t| + t.bigint "preview_card_id", null: false + t.float "score", default: 0.0, null: false + t.integer "rank", default: 0, null: false + t.boolean "allowed", default: false, null: false + t.string "language" + t.index ["preview_card_id"], name: "index_preview_card_trends_on_preview_card_id", unique: true + end + create_table "preview_cards", force: :cascade do |t| t.string "url", default: "", null: false t.string "title", default: "", null: false @@ -894,6 +903,17 @@ ActiveRecord::Schema.define(version: 2022_08_29_192658) do t.index ["status_id"], name: "index_status_stats_on_status_id", unique: true end + create_table "status_trends", force: :cascade do |t| + t.bigint "status_id", null: false + t.bigint "account_id", null: false + t.float "score", default: 0.0, null: false + t.integer "rank", default: 0, null: false + t.boolean "allowed", default: false, null: false + t.string "language" + t.index ["account_id"], name: "index_status_trends_on_account_id" + t.index ["status_id"], name: "index_status_trends_on_status_id", unique: true + end + create_table "statuses", id: :bigint, default: -> { "timestamp_id('statuses'::text)" }, force: :cascade do |t| t.string "uri" t.text "text", default: "", null: false @@ -1171,6 +1191,7 @@ ActiveRecord::Schema.define(version: 2022_08_29_192658) do add_foreign_key "poll_votes", "polls", on_delete: :cascade add_foreign_key "polls", "accounts", on_delete: :cascade add_foreign_key "polls", "statuses", on_delete: :cascade + add_foreign_key "preview_card_trends", "preview_cards", on_delete: :cascade add_foreign_key "report_notes", "accounts", on_delete: :cascade add_foreign_key "report_notes", "reports", on_delete: :cascade add_foreign_key "reports", "accounts", column: "action_taken_by_account_id", name: "fk_bca45b75fd", on_delete: :nullify @@ -1185,6 +1206,8 @@ ActiveRecord::Schema.define(version: 2022_08_29_192658) do add_foreign_key "status_pins", "accounts", name: "fk_d4cb435b62", on_delete: :cascade add_foreign_key "status_pins", "statuses", on_delete: :cascade add_foreign_key "status_stats", "statuses", on_delete: :cascade + add_foreign_key "status_trends", "accounts", on_delete: :cascade + add_foreign_key "status_trends", "statuses", on_delete: :cascade add_foreign_key "statuses", "accounts", column: "in_reply_to_account_id", name: "fk_c7fa917661", on_delete: :nullify add_foreign_key "statuses", "accounts", name: "fk_9bda1543f7", on_delete: :cascade add_foreign_key "statuses", "statuses", column: "in_reply_to_id", on_delete: :nullify |