0
0
Fork 0

Rewrite import feature (#21054)

This commit is contained in:
Claire 2023-05-02 12:08:48 +02:00 committed by GitHub
parent 0ad2413b35
commit 32a030dd74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 2059 additions and 113 deletions

View file

@ -0,0 +1,22 @@
# frozen_string_literal: true
class CreateBulkImports < ActiveRecord::Migration[6.1]
def change
create_table :bulk_imports do |t|
t.integer :type, null: false
t.integer :state, null: false
t.integer :total_items, null: false, default: 0
t.integer :imported_items, null: false, default: 0
t.integer :processed_items, null: false, default: 0
t.datetime :finished_at
t.boolean :overwrite, null: false, default: false
t.boolean :likely_mismatched, null: false, default: false
t.string :original_filename, null: false, default: ''
t.references :account, null: false, foreign_key: { on_delete: :cascade }
t.timestamps
end
add_index :bulk_imports, [:id], name: :index_bulk_imports_unconfirmed, where: 'state = 0'
end
end

View file

@ -0,0 +1,12 @@
# frozen_string_literal: true
class CreateBulkImportRows < ActiveRecord::Migration[6.1]
def change
create_table :bulk_import_rows do |t|
t.references :bulk_import, null: false, foreign_key: { on_delete: :cascade }
t.jsonb :data
t.timestamps
end
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2023_02_15_074423) do
ActiveRecord::Schema.define(version: 2023_03_30_140036) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -294,6 +294,31 @@ ActiveRecord::Schema.define(version: 2023_02_15_074423) do
t.index ["status_id"], name: "index_bookmarks_on_status_id"
end
create_table "bulk_import_rows", force: :cascade do |t|
t.bigint "bulk_import_id", null: false
t.jsonb "data"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["bulk_import_id"], name: "index_bulk_import_rows_on_bulk_import_id"
end
create_table "bulk_imports", force: :cascade do |t|
t.integer "type", null: false
t.integer "state", null: false
t.integer "total_items", default: 0, null: false
t.integer "imported_items", default: 0, null: false
t.integer "processed_items", default: 0, null: false
t.datetime "finished_at"
t.boolean "overwrite", default: false, null: false
t.boolean "likely_mismatched", default: false, null: false
t.string "original_filename", default: "", null: false
t.bigint "account_id", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["account_id"], name: "index_bulk_imports_on_account_id"
t.index ["id"], name: "index_bulk_imports_unconfirmed", where: "(state = 0)"
end
create_table "canonical_email_blocks", force: :cascade do |t|
t.string "canonical_email_hash", default: "", null: false
t.bigint "reference_account_id"
@ -1146,6 +1171,8 @@ ActiveRecord::Schema.define(version: 2023_02_15_074423) do
add_foreign_key "blocks", "accounts", name: "fk_4269e03e65", on_delete: :cascade
add_foreign_key "bookmarks", "accounts", on_delete: :cascade
add_foreign_key "bookmarks", "statuses", on_delete: :cascade
add_foreign_key "bulk_import_rows", "bulk_imports", on_delete: :cascade
add_foreign_key "bulk_imports", "accounts", on_delete: :cascade
add_foreign_key "canonical_email_blocks", "accounts", column: "reference_account_id", on_delete: :cascade
add_foreign_key "conversation_mutes", "accounts", name: "fk_225b4212bb", on_delete: :cascade
add_foreign_key "conversation_mutes", "conversations", on_delete: :cascade