diff --git a/source/data/tables.sql b/source/data/tables.sql index aee769177aa..9ccc3433883 100644 --- a/source/data/tables.sql +++ b/source/data/tables.sql @@ -45,7 +45,7 @@ CREATE TABLE email_opt_in_types ("id" bigint, "organisation_id" bigint, "kind" C DROP TABLE IF EXISTS email_opt_in_uploads; CREATE TABLE email_opt_in_uploads ("id" bigint, "organisation_id" bigint, "email_opt_in_type_id" bigint, "csv_file_url" CHARACTER VARYING(max), "created_at" timestamp without time zone, "updated_at" timestamp without time zone); DROP TABLE IF EXISTS event_imports; -CREATE TABLE event_imports ("id" integer, "event_import_batch_id" integer, "imported_event_id" integer, "import_status" CHARACTER VARYING(max), "import_errors" CHARACTER VARYING(max), "imported_at" timestamp without time zone, "last_processed_at" timestamp without time zone, "title" CHARACTER VARYING(max), "description" CHARACTER VARYING(max), "location" CHARACTER VARYING(max), "max_attendees_count" integer, "calendar_slug" CHARACTER VARYING(max), "time_zone" CHARACTER VARYING(max), "web_conference_url" CHARACTER VARYING(max), "host_email" CHARACTER VARYING(max), "locale" CHARACTER VARYING(max), "host_address" CHARACTER VARYING(max), "start_at_string" CHARACTER VARYING(max), "end_at_string" CHARACTER VARYING(max), "virtual" boolean, "target_slug" CHARACTER VARYING(max), "partnership_slugs" CHARACTER VARYING(max)); +CREATE TABLE event_imports ("id" integer, "event_import_batch_id" integer, "imported_event_id" integer, "import_status" CHARACTER VARYING(max), "import_errors" CHARACTER VARYING(max), "imported_at" timestamp without time zone, "last_processed_at" timestamp without time zone, "title" CHARACTER VARYING(max), "description" CHARACTER VARYING(max), "location" CHARACTER VARYING(max), "max_attendees_count" integer, "calendar_slug" CHARACTER VARYING(max), "time_zone" CHARACTER VARYING(max), "web_conference_url" CHARACTER VARYING(max), "host_email" CHARACTER VARYING(max), "locale" CHARACTER VARYING(max), "host_address" CHARACTER VARYING(max), "start_at_string" CHARACTER VARYING(max), "end_at_string" CHARACTER VARYING(max), "virtual" boolean, "target_slug" CHARACTER VARYING(max), "partnership_slugs" CHARACTER VARYING(max), "row_number" integer); DROP TABLE IF EXISTS event_types; CREATE TABLE event_types ("id" bigint, "organisation_id" bigint, "name" CHARACTER VARYING(max), "localized_names" CHARACTER VARYING(max), "created_at" timestamp without time zone, "updated_at" timestamp without time zone, "external_ids" CHARACTER VARYING(max), "crm_settings" CHARACTER VARYING(max)); DROP TABLE IF EXISTS events; @@ -53,7 +53,7 @@ CREATE TABLE events ("id" integer, "title" CHARACTER VARYING(max), "description" DROP TABLE IF EXISTS export_download_logs; CREATE TABLE export_download_logs ("id" bigint, "user_id" bigint, "data_export_id" bigint, "created_at" timestamp without time zone); DROP TABLE IF EXISTS external_events; -CREATE TABLE external_events ("id" bigint, "organisation_id" bigint, "title" CHARACTER VARYING(max), "description" CHARACTER VARYING(max), "location_id" bigint, "start_at" timestamp without time zone, "end_at" timestamp without time zone, "time_zone" CHARACTER VARYING(max), "url" CHARACTER VARYING(max), "external_ids" CHARACTER VARYING(max), "attending_count" integer, "created_at" timestamp without time zone, "updated_at" timestamp without time zone, "region_id" bigint, "source_system" CHARACTER VARYING(max), "local_chapter_id" bigint, "calendar_id" bigint, "featured" boolean, "event_type_id" bigint, "virtual" boolean); +CREATE TABLE external_events ("id" bigint, "organisation_id" bigint, "title" CHARACTER VARYING(max), "description" CHARACTER VARYING(max), "location_id" bigint, "start_at" timestamp without time zone, "end_at" timestamp without time zone, "time_zone" CHARACTER VARYING(max), "url" CHARACTER VARYING(max), "external_ids" CHARACTER VARYING(max), "attending_count" integer, "created_at" timestamp without time zone, "updated_at" timestamp without time zone, "region_id" bigint, "source_system" CHARACTER VARYING(max), "local_chapter_id" bigint, "calendar_id" bigint, "featured" boolean, "event_type_id" bigint, "virtual" boolean, "audience_geography_id" bigint); DROP TABLE IF EXISTS import_batches; CREATE TABLE import_batches ("id" integer, "organisation_id" integer, "user_id" integer, "original_csv_file_file_name" CHARACTER VARYING(max), "original_csv_file_content_type" CHARACTER VARYING(max), "original_csv_file_file_size" integer, "original_csv_file_updated_at" timestamp without time zone, "type" CHARACTER VARYING(max), "created_at" timestamp without time zone, "deleted_at" timestamp without time zone); DROP TABLE IF EXISTS labelings; @@ -61,7 +61,7 @@ CREATE TABLE labelings ("id" bigint, "label_id" bigint, "labelable_type" CHARACT DROP TABLE IF EXISTS labels; CREATE TABLE labels ("id" bigint, "organisation_id" bigint, "name" CHARACTER VARYING(max), "created_at" timestamp without time zone, "updated_at" timestamp without time zone, "crm_settings" CHARACTER VARYING(max), "public" boolean); DROP TABLE IF EXISTS local_chapter_members; -CREATE TABLE local_chapter_members ("id" integer, "local_chapter_id" integer, "member_id" integer, "introduction" CHARACTER VARYING(max), "created_at" timestamp without time zone, "updated_at" timestamp without time zone, "email" CHARACTER VARYING(max), "first_name" CHARACTER VARYING(max), "last_name" CHARACTER VARYING(max), "phone_number" CHARACTER VARYING(max), "postcode" CHARACTER VARYING(max), "country" CHARACTER VARYING(max), "locale" CHARACTER VARYING(max), "notification_level" CHARACTER VARYING(max), "type" CHARACTER VARYING(max), "local_chapter_organiser_request_id" integer, "user_id" integer, "deleted_at" timestamp without time zone, "eu_data_processing_consent_at" timestamp without time zone, "external_ids" CHARACTER VARYING(max), "synced_to_crm_at" timestamp without time zone, "new_member" boolean, "additional_fields" CHARACTER VARYING(max), "cached_organisation_slug" CHARACTER VARYING(max), "utm_params" CHARACTER VARYING(max)); +CREATE TABLE local_chapter_members ("id" integer, "local_chapter_id" integer, "member_id" integer, "introduction" CHARACTER VARYING(max), "created_at" timestamp without time zone, "updated_at" timestamp without time zone, "email" CHARACTER VARYING(max), "first_name" CHARACTER VARYING(max), "last_name" CHARACTER VARYING(max), "phone_number" CHARACTER VARYING(max), "postcode" CHARACTER VARYING(max), "country" CHARACTER VARYING(max), "locale" CHARACTER VARYING(max), "notification_level" CHARACTER VARYING(max), "type" CHARACTER VARYING(max), "local_chapter_organiser_request_id" integer, "user_id" integer, "deleted_at" timestamp without time zone, "eu_data_processing_consent_at" timestamp without time zone, "external_ids" CHARACTER VARYING(max), "synced_to_crm_at" timestamp without time zone, "new_member" boolean, "additional_fields" CHARACTER VARYING(max), "cached_organisation_slug" CHARACTER VARYING(max), "utm_params" CHARACTER VARYING(max), "deleted_by_user_id" bigint); DROP TABLE IF EXISTS local_chapters; CREATE TABLE local_chapters ("id" integer, "name" CHARACTER VARYING(max), "slug" CHARACTER VARYING(max), "organisation_id" integer, "geography_id" integer, "created_at" timestamp without time zone, "updated_at" timestamp without time zone, "description" CHARACTER VARYING(max), "local_chapter_collection_id" integer, "creation_survey_responses" CHARACTER VARYING(max), "location_id" integer, "welcome_email_content" CHARACTER VARYING(max), "last_activity_notification_sent_at" timestamp without time zone, "deleted_at" timestamp without time zone, "region_id" bigint, "unlisted" boolean, "mentor_id" bigint, "content_updated_at" timestamp without time zone, "external_ids" CHARACTER VARYING(max), "theme_id" bigint); DROP TABLE IF EXISTS locales; @@ -97,7 +97,7 @@ CREATE TABLE shifts ("id" bigint, "event_id" bigint, "name" CHARACTER VARYING(ma DROP TABLE IF EXISTS signatures; CREATE TABLE signatures ("petition_id" integer, "email" CHARACTER VARYING(max), "first_name" CHARACTER VARYING(max), "last_name" CHARACTER VARYING(max), "phone_number" CHARACTER VARYING(max), "postcode" CHARACTER VARYING(max), "created_at" timestamp without time zone, "join_organisation" boolean, "deleted_at" timestamp without time zone, "unsubscribe_at" timestamp without time zone, "member_id" integer, "additional_fields" CHARACTER VARYING(max), "cached_organisation_slug" CHARACTER VARYING(max), "source" CHARACTER VARYING(max), "new_member" boolean, "external_action_id" CHARACTER VARYING(max), "locale" CHARACTER VARYING(max), "bucket" CHARACTER VARYING(max), "country" CHARACTER VARYING(max), "updated_at" timestamp without time zone, "join_list_suppressed" boolean, "old_daisy_chain_used" CHARACTER VARYING(max), "from_embed" boolean, "confirmation_token" CHARACTER VARYING(max), "confirmed_at" timestamp without time zone, "confirmation_sent_at" timestamp without time zone, "last_signed_at" timestamp without time zone, "confirmed_reason" CHARACTER VARYING(max), "synced_to_crm_at" timestamp without time zone, "daisy_chain_experiment_slug" CHARACTER VARYING(max), "from_one_click" boolean, "eu_data_processing_consent" boolean, "consent_content_version_id" bigint, "daisy_chain_id_used" bigint, "email_opt_in_type_id" bigint, "facebook_id" CHARACTER VARYING(max), "utm_params" CHARACTER VARYING(max), "postcode_id" bigint, "referring_share_click_id" integer, "opt_in_sms" boolean, "sms_opt_in_type_id" bigint, "recaptcha_score" numeric(3,2), "new_mobile_subscriber" boolean, "external_ids" CHARACTER VARYING(max), "id" bigint, "partnership_opt_ins" CHARACTER VARYING(max), "after_action" CHARACTER VARYING(max), "user_ip" CHARACTER VARYING(max), "user_agent" CHARACTER VARYING(max)); DROP TABLE IF EXISTS sms_opt_in_types; -CREATE TABLE sms_opt_in_types ("id" bigint, "organisation_id" bigint, "context" CHARACTER VARYING(max), "kind" CHARACTER VARYING(max), "active" boolean, "content_settings" CHARACTER VARYING(max), "created_at" timestamp without time zone, "updated_at" timestamp without time zone, "phone_number_required" boolean); +CREATE TABLE sms_opt_in_types ("id" bigint, "organisation_id" bigint, "context" CHARACTER VARYING(max), "kind" CHARACTER VARYING(max), "active" boolean, "content_settings" CHARACTER VARYING(max), "created_at" timestamp without time zone, "updated_at" timestamp without time zone, "phone_number_required" boolean, "phone_number_requirement_set_from_org" boolean); DROP TABLE IF EXISTS stories; CREATE TABLE stories ("id" integer, "title" CHARACTER VARYING(max), "content" CHARACTER VARYING(max), "featured" boolean, "created_at" timestamp without time zone, "updated_at" timestamp without time zone, "image_file_name" CHARACTER VARYING(max), "image_content_type" CHARACTER VARYING(max), "image_file_size" integer, "image_updated_at" timestamp without time zone, "organisation_id" integer, "link" CHARACTER VARYING(max)); DROP TABLE IF EXISTS target_collections; @@ -117,6 +117,6 @@ CREATE TABLE timeline_posts ("id" integer, "text" CHARACTER VARYING(max), "user_ DROP TABLE IF EXISTS unsubscribes; CREATE TABLE unsubscribes ("id" integer, "organisation_id" integer, "member_id" integer, "blast_email_id" integer, "email" CHARACTER VARYING(max), "unsubscribe_object" boolean, "unsubscribe_organisation" boolean, "unsubscribable_id" integer, "unsubscribable_type" CHARACTER VARYING(max), "created_at" timestamp without time zone, "updated_at" timestamp without time zone, "externally_unsubscribed_at" timestamp without time zone, "bounce_id" integer, "source" CHARACTER VARYING(max), "external_ids" CHARACTER VARYING(max)); DROP TABLE IF EXISTS user_invitations; -CREATE TABLE user_invitations ("id" integer, "sender_id" integer, "recipient_id" integer, "recipient_email" CHARACTER VARYING(max), "organisation_id" integer, "token" CHARACTER VARYING(max), "accepted_at" timestamp without time zone, "created_at" timestamp without time zone, "updated_at" timestamp without time zone); +CREATE TABLE user_invitations ("id" integer, "sender_id" integer, "recipient_id" integer, "recipient_email" CHARACTER VARYING(max), "organisation_id" integer, "token" CHARACTER VARYING(max), "accepted_at" timestamp without time zone, "created_at" timestamp without time zone, "updated_at" timestamp without time zone, "last_invited_at" timestamp(6) without time zone); DROP TABLE IF EXISTS users; CREATE TABLE users ("id" integer, "email" CHARACTER VARYING(max), "reset_password_sent_at" timestamp without time zone, "remember_created_at" timestamp without time zone, "sign_in_count" integer, "current_sign_in_at" timestamp without time zone, "last_sign_in_at" timestamp without time zone, "current_sign_in_ip" CHARACTER VARYING(max), "last_sign_in_ip" CHARACTER VARYING(max), "created_at" timestamp without time zone, "updated_at" timestamp without time zone, "first_name" CHARACTER VARYING(max), "last_name" CHARACTER VARYING(max), "admin" boolean, "phone_number" CHARACTER VARYING(max), "postcode" CHARACTER VARYING(max), "join_organisation" boolean, "organisation_id" integer, "confirmed_at" timestamp without time zone, "confirmation_sent_at" timestamp without time zone, "opt_out_site_email" boolean, "member_id" integer, "additional_fields" CHARACTER VARYING(max), "cached_organisation_slug" CHARACTER VARYING(max), "image_file_name" CHARACTER VARYING(max), "image_content_type" CHARACTER VARYING(max), "image_file_size" integer, "image_updated_at" timestamp without time zone, "locale" CHARACTER VARYING(max), "token" CHARACTER VARYING(max), "new_member" boolean, "failed_attempts" integer, "unlock_token" CHARACTER VARYING(max), "locked_at" timestamp without time zone, "country" CHARACTER VARYING(max), "eu_data_processing_consent_at" timestamp without time zone, "email_opt_in_type_id" bigint, "external_ids" CHARACTER VARYING(max), "activated_at" timestamp without time zone, "activate_token" CHARACTER VARYING(max), "postcode_id" bigint, "recaptcha_score" numeric(3,2), "subscribed_to_marketing_list" boolean, "marketing_list_opt_in" boolean, "identity_provider_ids" CHARACTER VARYING(max), "home_region_id" bigint, "opt_in_sms" boolean, "sms_opt_in_type_id" bigint);