Skip to content

Commit a84f0d5

Browse files
committed
Add indexes to scripts and attachments
1 parent 8d4d191 commit a84f0d5

2 files changed

Lines changed: 28 additions & 20 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class AddIndexesToScriptsAndAttachments < ActiveRecord::Migration[8.1]
2+
def change
3+
add_index :scripts, :guid, unique: true
4+
add_index :attachments, :script_id
5+
end
6+
end

db/schema.rb

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,26 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[8.0].define(version: 2022_04_10_111444) do
13+
ActiveRecord::Schema[8.1].define(version: 2026_04_15_132023) do
1414
create_table "active_storage_attachments", force: :cascade do |t|
15-
t.string "name", null: false
16-
t.string "record_type", null: false
17-
t.integer "record_id", null: false
1815
t.integer "blob_id", null: false
1916
t.datetime "created_at", precision: nil, null: false
17+
t.string "name", null: false
18+
t.integer "record_id", null: false
19+
t.string "record_type", null: false
2020
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
2121
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
2222
end
2323

2424
create_table "active_storage_blobs", force: :cascade do |t|
25-
t.string "key", null: false
26-
t.string "filename", null: false
27-
t.string "content_type"
28-
t.text "metadata"
29-
t.string "service_name", null: false
3025
t.bigint "byte_size", null: false
3126
t.string "checksum"
27+
t.string "content_type"
3228
t.datetime "created_at", precision: nil, null: false
29+
t.string "filename", null: false
30+
t.string "key", null: false
31+
t.text "metadata"
32+
t.string "service_name", null: false
3333
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
3434
end
3535

@@ -40,40 +40,42 @@
4040
end
4141

4242
create_table "attachments", force: :cascade do |t|
43+
t.datetime "created_at", precision: nil
4344
t.integer "script_id"
44-
t.string "upload_file_name"
45+
t.datetime "updated_at", precision: nil
4546
t.string "upload_content_type"
47+
t.string "upload_file_name"
4648
t.bigint "upload_file_size"
4749
t.datetime "upload_updated_at", precision: nil
48-
t.datetime "created_at", precision: nil
49-
t.datetime "updated_at", precision: nil
50+
t.index ["script_id"], name: "index_attachments_on_script_id"
5051
end
5152

5253
create_table "logs", force: :cascade do |t|
54+
t.datetime "created_at", precision: nil
5355
t.string "host"
56+
t.text "memo"
5457
t.text "result"
58+
t.integer "result_bytes"
5559
t.integer "script_id"
56-
t.datetime "created_at", precision: nil
5760
t.datetime "updated_at", precision: nil
58-
t.text "memo"
59-
t.integer "result_bytes"
6061
end
6162

6263
create_table "scripts", force: :cascade do |t|
63-
t.string "name"
64+
t.boolean "archived"
6465
t.text "body"
66+
t.datetime "created_at", precision: nil
6567
t.integer "created_by_id"
66-
t.integer "updated_by_id"
6768
t.string "guid"
68-
t.boolean "archived"
69-
t.datetime "created_at", precision: nil
69+
t.string "name"
7070
t.datetime "updated_at", precision: nil
71+
t.integer "updated_by_id"
72+
t.index ["guid"], name: "index_scripts_on_guid", unique: true
7173
end
7274

7375
create_table "users", force: :cascade do |t|
76+
t.datetime "created_at", precision: nil
7477
t.string "name", null: false
7578
t.string "nickname", null: false
76-
t.datetime "created_at", precision: nil
7779
t.datetime "updated_at", precision: nil
7880
end
7981

0 commit comments

Comments
 (0)