class SquashMigrationV3 < ActiveRecord::Migration[6.1]
  def change
    # These are extensions that must be enabled in order to support this database
    enable_extension "hstore"
    enable_extension "plpgsql"

    create_table "accounts", force: :cascade do |t|
      t.string "name"
      t.string "subdomain"
      t.string "website_url"
    end

    create_table "active_storage_attachments", force: :cascade do |t|
      t.string "name", null: false
      t.string "record_type", null: false
      t.bigint "record_id", null: false
      t.bigint "blob_id", null: false
      t.datetime "created_at", null: false
      t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
      t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
    end

    create_table "active_storage_blobs", force: :cascade do |t|
      t.string "key", null: false
      t.string "filename", null: false
      t.string "content_type"
      t.text "metadata"
      t.bigint "byte_size", null: false
      t.string "checksum", null: false
      t.datetime "created_at", null: false
      t.string "service_name", null: false
      t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
    end

    create_table "active_storage_variant_records", force: :cascade do |t|
      t.bigint "blob_id", null: false
      t.string "variation_digest", null: false
      t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
    end

    create_table "anonymous_inquiries", force: :cascade do |t|
      t.integer "reason"
      t.text "body"
      t.string "fullname"
      t.string "email"
      t.hstore "meta"
      t.datetime "created_at", precision: 6, null: false
      t.datetime "updated_at", precision: 6, null: false
    end

    create_table "backups", force: :cascade do |t|
      t.string "fullpath"
      t.integer "state"
      t.bigint "user_id"
      t.datetime "created_at", null: false
      t.datetime "updated_at", null: false
      t.index ["user_id"], name: "index_backups_on_user_id"
    end

    create_table "categories", force: :cascade do |t|
      t.string "title"
      t.text "description"
      t.bigint "user_id"
      t.bigint "parent_id"
      t.boolean "active", default: true, null: false
      t.boolean "deletable", default: true, null: false
      t.string "slug"
      t.datetime "created_at", null: false
      t.datetime "updated_at", null: false
      t.string "type"
      t.index ["parent_id"], name: "index_categories_on_parent_id"
      t.index ["slug", "user_id"], name: "index_categories_on_slug_and_user_id", unique: true
      t.index ["user_id"], name: "index_categories_on_user_id"
    end

    create_table "digital_gardens", force: :cascade do |t|
      t.string "slug"
      t.string "title"
      t.boolean "enabled", null: false
      t.bigint "user_id", null: false
      t.datetime "created_at", precision: 6, null: false
      t.datetime "updated_at", precision: 6, null: false
      t.index ["slug"], name: "index_digital_gardens_on_slug"
      t.index ["user_id"], name: "index_digital_gardens_on_user_id"
    end

    create_table "digital_gardens_notes", id: false, force: :cascade do |t|
      t.bigint "digital_garden_id", null: false
      t.bigint "note_id", null: false
      t.index ["digital_garden_id", "note_id"], name: "index_dgs_notes"
      t.index ["note_id", "digital_garden_id"], name: "index_notes_dgs"
    end

    create_table "inquiries", force: :cascade do |t|
      t.integer "reason"
      t.text "body"
      t.bigint "user_id", null: false
      t.datetime "created_at", precision: 6, null: false
      t.datetime "updated_at", precision: 6, null: false
      t.hstore "meta"
      t.index ["user_id"], name: "index_inquiries_on_user_id"
    end

    create_table "notes", force: :cascade do |t|
      t.bigint "user_id"
      t.bigint "category_id"
      t.string "title"
      t.text "content"
      t.boolean "favorite"
      t.string "serial_no"
      t.string "images"
      t.integer "sharestate"
      t.string "guid"
      t.datetime "created_at", null: false
      t.datetime "updated_at", null: false
      t.boolean "dg_enabled", default: false
      t.string "ancestry"
      t.index ["ancestry"], name: "index_notes_on_ancestry"
      t.index ["category_id"], name: "index_notes_on_category_id"
      t.index ["guid"], name: "index_notes_on_guid", unique: true
      t.index ["user_id"], name: "index_notes_on_user_id"
    end

    create_table "taggings", force: :cascade do |t|
      t.bigint "tag_id"
      t.datetime "created_at", null: false
      t.datetime "updated_at", null: false
      t.string "taggable_type"
      t.integer "taggable_id"
      t.index ["tag_id"], name: "index_taggings_on_tag_id"
    end

    create_table "tags", force: :cascade do |t|
      t.string "name"
      t.datetime "created_at", null: false
      t.datetime "updated_at", null: false
      t.bigint "user_id"
      t.index ["user_id"], name: "index_tags_on_user_id"
    end

    create_table "users", force: :cascade do |t|
      t.string "email", default: "", null: false
      t.string "encrypted_password", default: "", null: false
      t.string "reset_password_token"
      t.datetime "reset_password_sent_at"
      t.datetime "remember_created_at"
      t.integer "sign_in_count", default: 0, null: false
      t.datetime "current_sign_in_at"
      t.datetime "last_sign_in_at"
      t.string "current_sign_in_ip"
      t.string "last_sign_in_ip"
      t.string "confirmation_token"
      t.datetime "confirmed_at"
      t.datetime "confirmation_sent_at"
      t.string "unconfirmed_email"
      t.string "firstname"
      t.string "lastname"
      t.string "provider"
      t.string "uid"
      t.string "token"
      t.integer "expires_at"
      t.boolean "expires"
      t.string "refresh_token"
      t.datetime "created_at", null: false
      t.datetime "updated_at", null: false
      t.string "username"
      t.bigint "account_id"
      t.text "add_ons", default: [], array: true
      t.index ["account_id"], name: "index_users_on_account_id"
      t.index ["email"], name: "index_users_on_email", unique: true
      t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
      t.index ["username"], name: "index_users_on_username", unique: true
    end

    add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
    add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
    add_foreign_key "backups", "users"
    add_foreign_key "categories", "categories", column: "parent_id"
    add_foreign_key "categories", "users"
    add_foreign_key "digital_gardens", "users"
    add_foreign_key "inquiries", "users"
    add_foreign_key "notes", "categories"
    add_foreign_key "notes", "users"
    add_foreign_key "taggings", "tags"
    add_foreign_key "tags", "users"
    add_foreign_key "users", "accounts"
  end
end
