-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
108 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
Sequel.migration do | ||
change do | ||
create_table :submission do | ||
primary_key :sub_id, type: :bigint | ||
|
||
bigint :usr_id, null: false | ||
text :submitter_id, null: false | ||
integer :serial, null: false | ||
integer :charge | ||
date :create_date | ||
date :submit_date | ||
date :hold_date | ||
date :dist_date | ||
date :finish_date | ||
text :note | ||
end | ||
|
||
create_table :status_history do | ||
primary_key :id, type: :bigint | ||
|
||
bigint :sub_id | ||
integer :status | ||
timestamp :date | ||
end | ||
|
||
create_table :operation_history do | ||
primary_key :his_id, type: :bigint | ||
|
||
integer :type | ||
text :summary | ||
text :file_name | ||
timestamp :date | ||
bigint :usr_id | ||
integer :serial | ||
text :submitter_id | ||
end | ||
|
||
create_table :ext_entity do | ||
primary_key :ext_id, type: :bigint | ||
|
||
text :acc_type | ||
text :ref_name | ||
integer :status | ||
end | ||
|
||
create_table :ext_permit do | ||
primary_key :per_id, type: :bigint | ||
|
||
bigint :ext_id | ||
text :submitter_id | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace :dra do | ||
namespace :db do | ||
desc 'Run migrations' | ||
task :migrate, [:version] do |t, args| | ||
require 'sequel/core' | ||
|
||
Sequel.extension :migration | ||
|
||
Sequel.connect ENV.fetch('DRA_DATABASE_URL') do |db| | ||
Sequel::Migrator.run db, 'app/models/database/dra/db/migrations', target: args[:version]&.to_i | ||
end | ||
end | ||
end | ||
end |