diff --git a/db/migrate/20240411160306_create_accredited_organizations.rb b/db/migrate/20240411160306_create_accredited_organizations.rb new file mode 100644 index 00000000000..e0bd8a1bc61 --- /dev/null +++ b/db/migrate/20240411160306_create_accredited_organizations.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +class CreateAccreditedOrganizations < ActiveRecord::Migration[7.1] + def change + create_table :accredited_organizations, id: :uuid do |t| + t.uuid :ogc_id, null: false + t.string :poa_code, limit: 3, null: false, index: { unique: true } + t.string :name, index: true + t.string :phone + t.string :address_type + t.string :address_line1 + t.string :address_line2 + t.string :address_line3 + t.string :city + t.string :country_code_iso3 + t.string :country_name + t.string :county_name + t.string :county_code + t.string :international_postal_code + t.string :province + t.string :state_code + t.string :zip_code + t.string :zip_suffix + t.jsonb :raw_address + t.float :lat + t.float :long + t.geography :location, limit: { srid: 4326, type: 'st_point', geographic: true } + t.timestamps + + t.index :location, using: :gist + end + end +end diff --git a/db/schema.rb b/db/schema.rb index a996325aa71..37726024dfc 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -90,6 +90,36 @@ t.index ["registration_number", "individual_type"], name: "index_on_reg_num_and_type_for_accredited_individuals", unique: true end + create_table "accredited_organizations", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| + t.uuid "ogc_id", null: false + t.string "poa_code", limit: 3, null: false + t.string "name" + t.string "phone" + t.string "address_type" + t.string "address_line1" + t.string "address_line2" + t.string "address_line3" + t.string "city" + t.string "country_code_iso3" + t.string "country_name" + t.string "county_name" + t.string "county_code" + t.string "international_postal_code" + t.string "province" + t.string "state_code" + t.string "zip_code" + t.string "zip_suffix" + t.jsonb "raw_address" + t.float "lat" + t.float "long" + t.geography "location", limit: {:srid=>4326, :type=>"st_point", :geographic=>true} + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["location"], name: "index_accredited_organizations_on_location", using: :gist + t.index ["name"], name: "index_accredited_organizations_on_name" + t.index ["poa_code"], name: "index_accredited_organizations_on_poa_code", unique: true + end + create_table "active_storage_attachments", force: :cascade do |t| t.string "name", null: false t.string "record_type", null: false