Skip to content

Commit

Permalink
add script to import mysql dump
Browse files Browse the repository at this point in the history
  • Loading branch information
amtuannguyen committed Nov 24, 2024
1 parent d95e843 commit 16a1de4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ config/app_settings.yml

.DS_Store
*.sql
*.sql.gz
8 changes: 8 additions & 0 deletions bin/import_db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
dump=$1

[ -f "$dump" ] && rails db:reset && zcat -f "$dump" | sed '/DROP DATABASE \|CREATE DATABASE \|USE `/d' | sed 's/ datetime / datetime(6) /' > import.sql

cat import.sql | rails db -p

rails db:migrate
22 changes: 11 additions & 11 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
t.float "remaining_vat_amount"
t.float "original_amount"
t.float "original_vat_amount"
t.datetime "creation_time", precision: nil
t.datetime "status_time", precision: nil
t.datetime "creation_time"
t.datetime "status_time"
t.string "owner_id"
t.string "owner_description"
t.text "item_title"
Expand All @@ -45,8 +45,8 @@
t.text "payment_token"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "alma_fines_paid_at", precision: nil
t.datetime "alma_fines_rejected_at", precision: nil
t.datetime "alma_fines_paid_at"
t.datetime "alma_fines_rejected_at"
t.string "alma_fines_rejected_error_reason"
t.string "alma_fines_rejected_error_code"
t.string "alma_fines_rejected_error_tracking_id"
Expand Down Expand Up @@ -76,9 +76,9 @@
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "yporderid"
t.datetime "alma_fines_paid_at", precision: nil
t.datetime "ypb_transaction_approved_at", precision: nil
t.datetime "ypb_transaction_declined_at", precision: nil
t.datetime "alma_fines_paid_at"
t.datetime "ypb_transaction_approved_at"
t.datetime "ypb_transaction_declined_at"
t.string "library_id"
t.string "user_primary_id"
end
Expand All @@ -88,7 +88,7 @@
t.string "alma_fee_id"
t.integer "transaction_id"
t.string "ypb_transaction_id"
t.datetime "logged_at", precision: nil
t.datetime "logged_at"
t.string "process_name"
t.text "message"
t.text "additional_changes"
Expand All @@ -112,11 +112,11 @@
t.string "encrypted_password", default: "", null: false
t.string "username"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at", precision: nil
t.datetime "last_sign_in_at", precision: nil
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.datetime "became_admin_at", precision: nil
t.datetime "became_admin_at"
t.integer "failed_attempts", default: 0, null: false
t.datetime "locked_at"
t.index ["yorku_id"], name: "index_users_on_yorku_id", unique: true
Expand Down

0 comments on commit 16a1de4

Please sign in to comment.