Skip to content
This repository has been archived by the owner on May 20, 2021. It is now read-only.

Commit

Permalink
switch to schema.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Merrill committed Apr 23, 2020
1 parent 34655fd commit efda1f0
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 34 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
/db/*.sqlite3
/db/*.sqlite3-journal


db/structure.sql

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module AtiDashboard
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.0
config.active_record.schema_format = :sql
# config.active_record.schema_format = :sql

config.middleware.insert_before 0, Rack::Cors do
allow do
Expand Down
78 changes: 45 additions & 33 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2020_02_05_183726) do
ActiveRecord::Schema.define(version: 2020_04_23_144433) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
enable_extension "postgres_fdw"
enable_extension "unaccent"


# you also have to set up this trigger:
# CREATE TRIGGER tsvectorupdate BEFORE INSERT OR UPDATE ON public.ad_texts FOR EACH ROW EXECUTE FUNCTION tsvector_update_trigger('tsv', 'pg_catalog.english', 'search_text');
# and potentially various tables are remote via postgres_fdw.

create_table "ad_archive_report_pages", force: :cascade do |t|
t.bigint "page_id"
t.string "page_name"
Expand Down Expand Up @@ -47,19 +53,29 @@
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.text "search_text"
t.index "to_tsvector('english'::regconfig, search_text)", name: "index_ads_on_search_text", using: :gin
t.tsvector "tsv"
t.bigint "page_id"
t.text "advertiser"
t.text "paid_for_by"
t.datetime "first_seen"
t.datetime "last_seen"
t.index ["advertiser"], name: "index_ad_texts_on_advertiser"
t.index ["first_seen"], name: "index_ad_texts_on_first_seen"
t.index ["last_seen"], name: "index_ad_texts_on_last_seen"
t.index ["page_id"], name: "index_ad_texts_on_page_id"
t.index ["paid_for_by"], name: "index_ad_texts_on_paid_for_by"
t.index ["tsv"], name: "index_ad_texts_on_tsv", using: :gin
end

create_table "ad_topics", force: :cascade do |t|
t.bigint "archive_id"
t.integer "topic_id"
t.float "proportion"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.integer "ad_text_id"
end

create_table "ads", id: false, force: :cascade do |t|
create_table "ads_local", id: false, force: :cascade do |t|
t.text "ad_creative_body"
t.datetime "ad_delivery_start_time", precision: 4
t.datetime "ad_delivery_stop_time", precision: 4
Expand All @@ -70,10 +86,10 @@
t.boolean "is_active"
t.integer "ad_sponsor_id"
t.bigint "archive_id", null: false
t.bigserial "nyu_id", null: false
t.bigint "nyu_id", default: -> { "nextval('ads_nyu_id_seq'::regclass)" }, null: false
t.string "ad_creative_link_caption"
t.string "ad_creative_link_description"
t.string "ad_creative_link_title"
t.string "ad_creative_link_description"
t.integer "ad_category_id"
t.bigint "ad_id"
t.string "country_code"
Expand All @@ -99,30 +115,25 @@
t.string "gender", limit: 255
end

create_table "demo_impressions", id: false, force: :cascade do |t|
t.bigint "archive_id"
t.integer "demo_id"
t.float "spend_percentage"
t.index ["archive_id", "demo_id"], name: "demo_impressions_unique_archive_id", unique: true
t.index ["archive_id"], name: "demo_impressions_archive_id_idx"
end

create_table "demo_impression_results", id: false, force: :cascade do |t|
t.bigint "archive_id"
create_table "demo_impressions_local", id: false, force: :cascade do |t|
t.bigint "ad_archive_id"
t.integer "demo_id"
t.integer "min_impressions"
t.integer "max_impressions"
t.integer "min_spend"
t.integer "max_spend"
t.index ["archive_id", "demo_id"], name: "demo_impressions_unique_archive_id", unique: true
t.index ["archive_id"], name: "demo_impressions_archive_id_idx"
t.date "crawl_date"
t.boolean "most_recent"
t.bigint "nyu_id", default: -> { "nextval('demo_impressions_nyu_id1_seq'::regclass)" }, null: false
t.index ["ad_archive_id", "demo_id"], name: "demo_impressions_unique_ad_archive_id", unique: true
t.index ["ad_archive_id"], name: "demo_impressions_archive_id_idx"
end

create_table "fbpac_ads", id: :text, force: :cascade do |t|
t.text "html", null: false
t.integer "political", null: false
t.integer "not_political", null: false
t.text "title", null: false
t.text "title"
t.text "message", null: false
t.text "thumbnail", null: false
t.datetime "created_at", default: -> { "now()" }, null: false
Expand All @@ -142,6 +153,7 @@
t.text "paid_for_by"
t.integer "targetedness"
t.decimal "listbuilding_fundraising_proba", precision: 9, scale: 6
t.bigint "page_id"
t.index ["advertiser"], name: "index_fbpac_ads_on_advertiser"
t.index ["entities"], name: "index_fbpac_ads_on_entities", using: :gin
t.index ["lang"], name: "index_fbpac_ads_on_browser_lang"
Expand All @@ -151,7 +163,7 @@
t.index ["targets"], name: "index_fbpac_ads_on_targets", using: :gin
end

create_table "impressions", id: false, force: :cascade do |t|
create_table "impressions_local", id: false, force: :cascade do |t|
t.bigint "ad_archive_id"
t.date "crawl_date"
t.integer "min_impressions"
Expand All @@ -164,7 +176,7 @@
t.index ["ad_archive_id"], name: "impressions_unique_ad_archive_id", unique: true
end

create_table "pages", id: false, force: :cascade do |t|
create_table "pages_local", id: false, force: :cascade do |t|
t.string "page_name", limit: 255
t.bigint "page_id"
t.boolean "federal_candidate"
Expand All @@ -179,24 +191,18 @@
t.datetime "updated_at", precision: 6, null: false
end

create_table "region_impressions", id: false, force: :cascade do |t|
t.bigint "archive_id"
create_table "region_impressions_local", id: false, force: :cascade do |t|
t.bigint "ad_archive_id"
t.integer "region_id"
t.integer "min_impressions"
t.integer "min_spend"
t.integer "max_impressions"
t.integer "max_spend"
t.date "crawl_date"
t.boolean "most_recent"
t.bigint "nyu_id", default: -> { "nextval('region_impressions_nyu_id1_seq'::regclass)" }, null: false
t.index ["archive_id", "region_id"], name: "region_impressions_unique_archive_id", unique: true
t.index ["archive_id"], name: "region_impressions_archive_id_idx"
end

create_table "region_impression_results", id: false, force: :cascade do |t|
t.bigint "archive_id"
t.integer "region_id"
t.float "spend_percentage"
t.index ["archive_id", "region_id"], name: "region_impressions_unique_archive_id", unique: true
t.index ["archive_id"], name: "region_impressions_archive_id_idx"
t.index ["ad_archive_id", "region_id"], name: "region_impressions_unique_ad_archive_id", unique: true
t.index ["ad_archive_id"], name: "region_impressions_archive_id_idx"
end

create_table "regions", id: :serial, force: :cascade do |t|
Expand Down Expand Up @@ -231,6 +237,11 @@
t.datetime "updated_at", precision: 6, null: false
t.string "text_hash"
t.text "ad_id"
t.bigint "page_id"
t.boolean "swing_state_ad"
t.index ["ad_id"], name: "index_writable_ads_on_ad_id"
t.index ["archive_id"], name: "index_writable_ads_on_archive_id"
t.index ["page_id"], name: "index_writable_ads_on_page_id"
t.index ["text_hash"], name: "index_writable_ads_on_text_hash"
end

Expand All @@ -240,6 +251,7 @@
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.string "disclaimer"
t.boolean "core", default: false
end

end

0 comments on commit efda1f0

Please sign in to comment.