Skip to content

Commit

Permalink
Merge pull request #828 from pooza/3_1_0
Browse files Browse the repository at this point in the history
3.1.0
  • Loading branch information
pooza authored Jul 17, 2022
2 parents 0ce4ef5 + 19a93cc commit 15b3df7
Show file tree
Hide file tree
Showing 16 changed files with 160 additions and 614 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,6 @@ jobs:
bundle exec rake bundle:update
git diff
bundle exec rake bundle:check
- name: update database
run: |
echo '*:*:*:*:password' >> ~/.pgpass
chmod 600 ~/.pgpass
psql -U postgres -h localhost -p 5432 -w makoto < ./db/init.sql
bundle exec rake makoto:quote:update
bundle exec rake makoto:track:update
bundle exec rake makoto:fairy:update
bundle exec rake makoto:keyword:update
bundle exec rake makoto:message:update
- name: Run lint
run: |
bundle exec rubocop
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ gem 'ginseng-postgres', github: 'pooza/ginseng-postgres', require: 'ginseng/post
gem 'ginseng-web', github: 'pooza/ginseng-web', require: 'ginseng/web'
gem 'natto'
gem 'redis', '~>4.5.0'
gem 'sidekiq', '~>6.4.0'
gem 'sidekiq-scheduler', '~>3.1.0'
gem 'sidekiq', '~>6.5.0'
gem 'sidekiq-scheduler', '~>4.0.0'

group :development do
gem 'rack-test'
Expand Down
49 changes: 22 additions & 27 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,20 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actionpack (7.0.3)
actionview (= 7.0.3)
activesupport (= 7.0.3)
actionpack (7.0.3.1)
actionview (= 7.0.3.1)
activesupport (= 7.0.3.1)
rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionview (7.0.3)
activesupport (= 7.0.3)
actionview (7.0.3.1)
activesupport (= 7.0.3.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activesupport (7.0.3)
activesupport (7.0.3.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand All @@ -105,7 +105,6 @@ GEM
digest (3.1.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
e2mmap (0.1.0)
erb (2.2.3)
cgi
erubi (1.10.0)
Expand All @@ -127,7 +126,7 @@ GEM
httparty (0.20.0)
mime-types (~> 3.0)
multi_xml (>= 0.5.2)
i18n (1.10.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
json (2.6.2)
json-schema (3.0.0)
Expand All @@ -146,7 +145,7 @@ GEM
msgpack (1.5.3)
multi_json (1.15.0)
multi_xml (0.6.0)
mustermann (1.1.1)
mustermann (1.1.2)
ruby2_keywords (~> 0.0.1)
natto (1.2.0)
ffi (>= 1.9.0)
Expand All @@ -158,10 +157,10 @@ GEM
timeout
netrc (0.11.0)
nio4r (2.5.8)
nokogiri (1.13.6)
nokogiri (1.13.7)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
nokogiri (1.13.6-x86_64-linux)
nokogiri (1.13.7-x86_64-linux)
racc (~> 1.4)
optparse (0.2.0)
parallel (1.22.1)
Expand All @@ -175,7 +174,7 @@ GEM
raabro (1.4.0)
racc (1.6.0)
rack (2.2.4)
rack-protection (2.2.0)
rack-protection (2.2.1)
rack
rack-test (2.0.2)
rack (>= 1.3)
Expand Down Expand Up @@ -212,7 +211,7 @@ GEM
rubocop-ast (>= 1.18.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.18.0)
rubocop-ast (1.19.1)
parser (>= 3.1.1.0)
rubocop-minitest (0.20.1)
rubocop (>= 0.90, < 2.0)
Expand All @@ -225,7 +224,7 @@ GEM
rubocop (~> 1.0)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.5)
rufus-scheduler (3.8.1)
rufus-scheduler (3.8.2)
fugit (~> 1.1, >= 1.1.6)
sanitize (6.0.0)
crass (~> 1.0.2)
Expand All @@ -235,30 +234,26 @@ GEM
securerandom (0.2.0)
sequel (5.58.0)
set (1.0.2)
sidekiq (6.4.2)
sidekiq (6.5.1)
connection_pool (>= 2.2.2)
rack (~> 2.0)
redis (>= 4.2.0)
sidekiq-scheduler (3.1.1)
e2mmap
redis (>= 3, < 5)
sidekiq-scheduler (4.0.2)
redis (>= 4.2.0)
rufus-scheduler (~> 3.2)
sidekiq (>= 3)
thwait
sidekiq (>= 4)
tilt (>= 1.4.0)
sinatra (2.2.0)
sinatra (2.2.1)
mustermann (~> 1.0)
rack (~> 2.2)
rack-protection (= 2.2.0)
rack-protection (= 2.2.1)
tilt (~> 2.0)
slim (4.1.0)
temple (>= 0.7.6, < 0.9)
tilt (>= 2.0.6, < 2.1)
temple (0.8.2)
test-unit (3.5.3)
power_assert
thwait (0.2.0)
e2mmap
tilt (2.0.10)
time (0.2.0)
date
Expand Down Expand Up @@ -300,13 +295,13 @@ DEPENDENCIES
rubocop-performance
rubocop-rake
rubocop-sequel
sidekiq (~> 6.4.0)
sidekiq-scheduler (~> 3.1.0)
sidekiq (~> 6.5.0)
sidekiq-scheduler (~> 4.0.0)
test-unit
timecop

RUBY VERSION
ruby 3.1.2p20

BUNDLED WITH
2.3.17
2.3.18
13 changes: 13 additions & 0 deletions app/migration/001_create_account.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Sequel.migration do
transaction
up do
create_table(:account, ignore_index_errors: true) do
primary_key :id
String :acct, size: 64, null: false
Integer :favorability, default: 0, null: false
String :nickname, size: 64

index [:acct], name: :account_acct_key, unique: true
end
end
end
13 changes: 13 additions & 0 deletions app/migration/002_create_fairy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Sequel.migration do
transaction
up do
create_table(:fairy, ignore_index_errors: true) do
primary_key :id
String :name, text: true, null: false
String :human_name, text: true
String :suffix, text: true

index [:name], name: :fairy_name_key, unique: true
end
end
end
11 changes: 11 additions & 0 deletions app/migration/003_create_form.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Sequel.migration do
transaction
up do
create_table(:form, ignore_index_errors: true) do
primary_key :id
String :name, size: 64, null: false

index [:name], name: :form_name_idx, unique: true
end
end
end
12 changes: 12 additions & 0 deletions app/migration/004_create_keyword.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Sequel.migration do
transaction
up do
create_table(:keyword, ignore_index_errors: true) do
primary_key :id
String :type, size: 64
String :word, size: 64

index [:type, :word], name: :keyword_type_word_idx, unique: true
end
end
end
17 changes: 17 additions & 0 deletions app/migration/005_create_message.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Sequel.migration do
transaction
up do
create_table(:message, ignore_index_errors: true) do
primary_key :id
String :type, size: 64, null: false
String :feature, size: 64
String :message, text: true, null: false
Integer :month
Integer :day
String :data

index [:feature], name: :message_feature_idx
index [:type], name: :message_type_idx
end
end
end
11 changes: 11 additions & 0 deletions app/migration/006_create_series.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Sequel.migration do
transaction
up do
create_table(:series, ignore_index_errors: true) do
primary_key :id
String :name, size: 256, null: false

index [:name], name: :series_name_idx, unique: true
end
end
end
14 changes: 14 additions & 0 deletions app/migration/007_create_track.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Sequel.migration do
transaction
up do
create_table(:track, ignore_index_errors: true) do
primary_key :id
String :title, text: true
String :url, text: true
TrueClass :makoto, default: false, null: false
String :intro, text: true

index [:url], name: :track_url_idx, unique: true
end
end
end
12 changes: 12 additions & 0 deletions app/migration/008_create_past_keyword.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Sequel.migration do
transaction
up do
create_table(:past_keyword) do
primary_key :id
foreign_key :account_id, :account, null: false, key: [:id], on_delete: :cascade
DateTime :created_at, null: false
String :surface, size: 64, null: false
String :feature, size: 16
end
end
end
17 changes: 17 additions & 0 deletions app/migration/009_create_quote.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Sequel.migration do
transaction
up do
create_table(:quote) do
primary_key :id
foreign_key :series_id, :series, null: false, key: [:id], on_delete: :cascade
foreign_key :form_id, :form, null: false, key: [:id], on_delete: :cascade
Integer :episode
String :emotion, size: 16
TrueClass :exclude, default: false, null: false
TrueClass :exclude_respond, default: false, null: false
Integer :priority, null: false
String :body, text: true, null: false
String :remark, text: true
end
end
end
2 changes: 1 addition & 1 deletion app/task/makoto/daemons.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Makoto
end

desc "restart #{ns}"
task restart: [:stop, :start]
task restart: ['migration:run', :stop, :start]
end
end
end
Expand Down
14 changes: 14 additions & 0 deletions app/task/migration.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module Makoto
extend Rake::DSL

namespace :migration do
desc 'migrate database'
task :run do
path = File.join(Environment.dir, 'app/migration')
sh "bundle exec sequel -m #{path} '#{Postgres.dsn}' -E"
end
end

desc 'alias of migration:run'
task migrate: ['migration:run']
end
2 changes: 1 addition & 1 deletion config/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ package:
- tkoishi@b-shock.co.jp
license: MIT
url: https://github.com/pooza/makoto
version: 3.0.33
version: 3.1.0
postgres:
dsn: postgres://postgres:password@localhost:5432/makoto
puma:
Expand Down
Loading

0 comments on commit 15b3df7

Please sign in to comment.