souls 0.24.1 → 0.24.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. checksums.yaml +4 -4
  2. data/exe/souls +12 -1
  3. data/lib/souls.rb +181 -123
  4. data/lib/souls/gcloud/iam.rb +30 -16
  5. data/lib/souls/init.rb +22 -16
  6. data/lib/souls/version.rb +1 -1
  7. metadata +16 -193
  8. data/.gitignore +0 -15
  9. data/.irbrc +0 -2
  10. data/.rspec +0 -3
  11. data/.rubocop.yml +0 -152
  12. data/.ruby-version +0 -1
  13. data/.travis.yml +0 -6
  14. data/Gemfile +0 -13
  15. data/Gemfile.lock +0 -98
  16. data/Rakefile +0 -23
  17. data/Steepfile +0 -8
  18. data/api_v0.0.1.tar.gz +0 -0
  19. data/apps/api/.env.sample +0 -7
  20. data/apps/api/.gitignore +0 -32
  21. data/apps/api/.irbrc +0 -1
  22. data/apps/api/.rspec +0 -3
  23. data/apps/api/.rubocop.yml +0 -132
  24. data/apps/api/.ruby-version +0 -1
  25. data/apps/api/CODE_OF_CONDUCT.md +0 -74
  26. data/apps/api/Dockerfile +0 -16
  27. data/apps/api/Dockerfile.dev +0 -17
  28. data/apps/api/Gemfile +0 -50
  29. data/apps/api/Gemfile.lock +0 -412
  30. data/apps/api/LICENSE.txt +0 -67
  31. data/apps/api/Procfile +0 -2
  32. data/apps/api/Procfile.dev +0 -2
  33. data/apps/api/README.md +0 -37
  34. data/apps/api/Rakefile +0 -5
  35. data/apps/api/app.rb +0 -114
  36. data/apps/api/app/engines/notification_engine.rb +0 -5
  37. data/apps/api/app/graphql/mutations/.keep +0 -0
  38. data/apps/api/app/graphql/mutations/base/article/create_article.rb +0 -30
  39. data/apps/api/app/graphql/mutations/base/article/delete_article.rb +0 -17
  40. data/apps/api/app/graphql/mutations/base/article/destroy_delete_article.rb +0 -17
  41. data/apps/api/app/graphql/mutations/base/article/update_article.rb +0 -30
  42. data/apps/api/app/graphql/mutations/base/article_category/create_article_category.rb +0 -21
  43. data/apps/api/app/graphql/mutations/base/article_category/delete_article_category.rb +0 -17
  44. data/apps/api/app/graphql/mutations/base/article_category/destroy_delete_article_category.rb +0 -17
  45. data/apps/api/app/graphql/mutations/base/article_category/update_article_category.rb +0 -21
  46. data/apps/api/app/graphql/mutations/base/user/create_user.rb +0 -31
  47. data/apps/api/app/graphql/mutations/base/user/delete_user.rb +0 -17
  48. data/apps/api/app/graphql/mutations/base/user/destroy_delete_user.rb +0 -17
  49. data/apps/api/app/graphql/mutations/base/user/update_user.rb +0 -31
  50. data/apps/api/app/graphql/mutations/base_mutation.rb +0 -65
  51. data/apps/api/app/graphql/mutations/managers/user_manager/add_user_role.rb +0 -22
  52. data/apps/api/app/graphql/mutations/managers/user_manager/remove_user_role.rb +0 -22
  53. data/apps/api/app/graphql/mutations/managers/user_manager/sign_in_user.rb +0 -45
  54. data/apps/api/app/graphql/queries/article.rb +0 -13
  55. data/apps/api/app/graphql/queries/article_categories.rb +0 -11
  56. data/apps/api/app/graphql/queries/article_category.rb +0 -13
  57. data/apps/api/app/graphql/queries/articles.rb +0 -11
  58. data/apps/api/app/graphql/queries/base_query.rb +0 -12
  59. data/apps/api/app/graphql/queries/me.rb +0 -11
  60. data/apps/api/app/graphql/queries/user.rb +0 -13
  61. data/apps/api/app/graphql/queries/users.rb +0 -11
  62. data/apps/api/app/graphql/resolvers/article_category_search.rb +0 -41
  63. data/apps/api/app/graphql/resolvers/article_search.rb +0 -57
  64. data/apps/api/app/graphql/resolvers/base.rb +0 -17
  65. data/apps/api/app/graphql/resolvers/user_search.rb +0 -63
  66. data/apps/api/app/graphql/souls_api_schema.rb +0 -43
  67. data/apps/api/app/graphql/types/.keep +0 -0
  68. data/apps/api/app/graphql/types/article_category_type.rb +0 -12
  69. data/apps/api/app/graphql/types/article_type.rb +0 -30
  70. data/apps/api/app/graphql/types/base/base_argument.rb +0 -4
  71. data/apps/api/app/graphql/types/base/base_enum.rb +0 -4
  72. data/apps/api/app/graphql/types/base/base_field.rb +0 -5
  73. data/apps/api/app/graphql/types/base/base_input_object.rb +0 -5
  74. data/apps/api/app/graphql/types/base/base_interface.rb +0 -7
  75. data/apps/api/app/graphql/types/base/base_object.rb +0 -6
  76. data/apps/api/app/graphql/types/base/base_scalar.rb +0 -4
  77. data/apps/api/app/graphql/types/base/base_union.rb +0 -4
  78. data/apps/api/app/graphql/types/base/mutation_type.rb +0 -26
  79. data/apps/api/app/graphql/types/base/query_type.rb +0 -18
  80. data/apps/api/app/graphql/types/connections/article_category_connection.rb +0 -3
  81. data/apps/api/app/graphql/types/connections/article_connection.rb +0 -3
  82. data/apps/api/app/graphql/types/connections/base_connection.rb +0 -14
  83. data/apps/api/app/graphql/types/connections/user_connection.rb +0 -3
  84. data/apps/api/app/graphql/types/edges/article_category_edge.rb +0 -5
  85. data/apps/api/app/graphql/types/edges/article_edge.rb +0 -5
  86. data/apps/api/app/graphql/types/edges/base_edge.rb +0 -4
  87. data/apps/api/app/graphql/types/edges/user_edge.rb +0 -5
  88. data/apps/api/app/graphql/types/user_type.rb +0 -24
  89. data/apps/api/app/models/article.rb +0 -4
  90. data/apps/api/app/models/article_category.rb +0 -3
  91. data/apps/api/app/models/user.rb +0 -19
  92. data/apps/api/app/policies/application_policy.rb +0 -40
  93. data/apps/api/app/policies/article_category_policy.rb +0 -31
  94. data/apps/api/app/policies/article_policy.rb +0 -31
  95. data/apps/api/app/policies/user_policy.rb +0 -35
  96. data/apps/api/app/utils/association_loader.rb +0 -50
  97. data/apps/api/app/utils/fire_store.rb +0 -9
  98. data/apps/api/app/utils/firebase_id_token.rb +0 -4
  99. data/apps/api/app/utils/json_web_token.rb +0 -13
  100. data/apps/api/app/utils/record_loader.rb +0 -10
  101. data/apps/api/app/utils/souls_helper.rb +0 -18
  102. data/apps/api/cloudbuild.yml +0 -32
  103. data/apps/api/config.ru +0 -17
  104. data/apps/api/config/database.yml +0 -33
  105. data/apps/api/config/souls.rb +0 -10
  106. data/apps/api/constants/areas.rb +0 -71
  107. data/apps/api/constants/column_name_ja.rb +0 -27
  108. data/apps/api/db/migrate/20200006095538_create_users.rb +0 -30
  109. data/apps/api/db/migrate/20200712180236_create_article_categories.rb +0 -12
  110. data/apps/api/db/migrate/20200714215521_create_articles.rb +0 -22
  111. data/apps/api/db/schema.rb +0 -78
  112. data/apps/api/db/seeds.rb +0 -44
  113. data/apps/api/github/workflows/delivery.yml +0 -81
  114. data/apps/api/log/.keep +0 -0
  115. data/apps/api/spec/factories/article_categories.rb +0 -9
  116. data/apps/api/spec/factories/articles.rb +0 -17
  117. data/apps/api/spec/factories/users.rb +0 -23
  118. data/apps/api/spec/models/article_category_spec.rb +0 -7
  119. data/apps/api/spec/models/article_spec.rb +0 -7
  120. data/apps/api/spec/models/user_spec.rb +0 -7
  121. data/apps/api/spec/mutations/base/article_category_spec.rb +0 -46
  122. data/apps/api/spec/mutations/base/article_spec.rb +0 -70
  123. data/apps/api/spec/mutations/base/user_spec.rb +0 -76
  124. data/apps/api/spec/policies/article_category_policy_spec.rb +0 -25
  125. data/apps/api/spec/policies/article_policy_spec.rb +0 -25
  126. data/apps/api/spec/policies/user_policy_spec.rb +0 -5
  127. data/apps/api/spec/queries/article_category_spec.rb +0 -39
  128. data/apps/api/spec/queries/article_spec.rb +0 -53
  129. data/apps/api/spec/queries/user_spec.rb +0 -59
  130. data/apps/api/spec/resolvers/article_category_search_spec.rb +0 -54
  131. data/apps/api/spec/resolvers/article_search_spec.rb +0 -68
  132. data/apps/api/spec/resolvers/user_search_spec.rb +0 -74
  133. data/apps/api/spec/spec_helper.rb +0 -110
  134. data/apps/api/tmp/.keep +0 -0
  135. data/apps/worker/.env.sample +0 -9
  136. data/apps/worker/.gitignore +0 -32
  137. data/apps/worker/.irbrc +0 -1
  138. data/apps/worker/.rspec +0 -3
  139. data/apps/worker/.rubocop.yml +0 -132
  140. data/apps/worker/.ruby-version +0 -1
  141. data/apps/worker/CODE_OF_CONDUCT.md +0 -74
  142. data/apps/worker/Dockerfile +0 -16
  143. data/apps/worker/Dockerfile.dev +0 -17
  144. data/apps/worker/Gemfile +0 -49
  145. data/apps/worker/Gemfile.lock +0 -396
  146. data/apps/worker/LICENSE.txt +0 -67
  147. data/apps/worker/Procfile +0 -1
  148. data/apps/worker/Procfile.dev +0 -1
  149. data/apps/worker/README.md +0 -37
  150. data/apps/worker/Rakefile +0 -5
  151. data/apps/worker/app.rb +0 -101
  152. data/apps/worker/app/engines/notification_engine.rb +0 -5
  153. data/apps/worker/app/graphql/mutations/.keep +0 -0
  154. data/apps/worker/app/graphql/mutations/base_mutation.rb +0 -16
  155. data/apps/worker/app/graphql/mutations/workers/send_user_mail_job.rb +0 -31
  156. data/apps/worker/app/graphql/souls_api_schema.rb +0 -43
  157. data/apps/worker/app/graphql/types/.keep +0 -0
  158. data/apps/worker/app/graphql/types/base/base_argument.rb +0 -4
  159. data/apps/worker/app/graphql/types/base/base_enum.rb +0 -4
  160. data/apps/worker/app/graphql/types/base/base_field.rb +0 -5
  161. data/apps/worker/app/graphql/types/base/base_input_object.rb +0 -5
  162. data/apps/worker/app/graphql/types/base/base_interface.rb +0 -7
  163. data/apps/worker/app/graphql/types/base/base_object.rb +0 -5
  164. data/apps/worker/app/graphql/types/base/base_scalar.rb +0 -4
  165. data/apps/worker/app/graphql/types/base/base_union.rb +0 -4
  166. data/apps/worker/app/graphql/types/base/mutation_type.rb +0 -12
  167. data/apps/worker/app/graphql/types/base/query_type.rb +0 -6
  168. data/apps/worker/app/models/article.rb +0 -4
  169. data/apps/worker/app/models/article_category.rb +0 -3
  170. data/apps/worker/app/models/user.rb +0 -19
  171. data/apps/worker/app/utils/fire_store.rb +0 -9
  172. data/apps/worker/app/utils/souls_helper.rb +0 -96
  173. data/apps/worker/cloudbuild.yml +0 -32
  174. data/apps/worker/config.ru +0 -17
  175. data/apps/worker/config/database.yml +0 -33
  176. data/apps/worker/config/souls.rb +0 -10
  177. data/apps/worker/db/migrate/20200006095538_create_users.rb +0 -30
  178. data/apps/worker/db/migrate/20200712180236_create_article_categories.rb +0 -12
  179. data/apps/worker/db/migrate/20200714215521_create_articles.rb +0 -22
  180. data/apps/worker/db/schema.rb +0 -78
  181. data/apps/worker/db/seeds.rb +0 -44
  182. data/apps/worker/github/workflows/delivery.yml +0 -81
  183. data/apps/worker/log/.keep +0 -0
  184. data/apps/worker/spec/factories/article_categories.rb +0 -9
  185. data/apps/worker/spec/factories/articles.rb +0 -17
  186. data/apps/worker/spec/factories/users.rb +0 -23
  187. data/apps/worker/spec/models/article_category_spec.rb +0 -7
  188. data/apps/worker/spec/models/article_spec.rb +0 -7
  189. data/apps/worker/spec/models/user_spec.rb +0 -7
  190. data/apps/worker/spec/spec_helper.rb +0 -110
  191. data/apps/worker/tmp/.keep +0 -0
  192. data/bin/console +0 -14
  193. data/bin/setup +0 -8
  194. data/config/souls.rb +0 -9
  195. data/db/schema.rb +0 -67
  196. data/rbs/init.rbs +0 -2
  197. data/souls.gemspec +0 -34
  198. data/souls_api2.tar.gz +0 -0
@@ -1,50 +0,0 @@
1
- class AssociationLoader < GraphQL::Batch::Loader
2
- def self.validate(model, association_name)
3
- new(model, association_name)
4
- nil
5
- end
6
-
7
- def initialize(model, association_name)
8
- super()
9
- @model = model
10
- @association_name = association_name
11
- validate
12
- end
13
-
14
- def load(record)
15
- raise(TypeError, "#{@model} loader can't load association for #{record.class}") unless record.is_a?(@model)
16
- return Promise.resolve(read_association(record)) if association_loaded?(record)
17
-
18
- super
19
- end
20
-
21
- # We want to load the associations on all records, even if they have the same id
22
- def cache_key(record)
23
- record.object_id
24
- end
25
-
26
- def perform(records)
27
- preload_association(records)
28
- records.each { |record| fulfill(record, read_association(record)) }
29
- end
30
-
31
- private
32
-
33
- def validate
34
- return if @model.reflect_on_association(@association_name)
35
-
36
- raise(ArgumentError, "No association #{@association_name} on #{@model}")
37
- end
38
-
39
- def preload_association(records)
40
- ::ActiveRecord::Associations::Preloader.new.preload(records, @association_name)
41
- end
42
-
43
- def read_association(record)
44
- record.public_send(@association_name)
45
- end
46
-
47
- def association_loaded?(record)
48
- record.association(@association_name).loaded?
49
- end
50
- end
@@ -1,9 +0,0 @@
1
- module FireStore
2
- def self.log(title: "error", message: "type error!")
3
- Time.zone = "Asia/Tokyo"
4
- time = Time.zone.now.strftime("%F-%H-%M-%S")
5
- firestore = Google::Cloud::Firestore.new(project_id: "usmef-japan-trade")
6
- doc_ref = firestore.doc("Log/#{time}")
7
- doc_ref.set({ title: title, message: message, created_at: time })
8
- end
9
- end
@@ -1,4 +0,0 @@
1
- FirebaseIdToken.configure do |config|
2
- config.project_ids = ["souls-app"]
3
- config.redis = Redis.new
4
- end
@@ -1,13 +0,0 @@
1
- module JsonWebToken
2
- SECRET_KEY = ENV["SECRET_KEY_BASE"] || ""
3
- private_constant :SECRET_KEY
4
- def self.encode(payload, exp = 24.hours.from_now)
5
- exp.to_i.zero? ? payload.delete(:exp) : payload[:exp] = exp.to_i
6
- JWT.encode(payload, SECRET_KEY)
7
- end
8
-
9
- def self.decode(token)
10
- decoded = JWT.decode(token, SECRET_KEY)[0]
11
- HashWithIndifferentAccess.new(decoded)
12
- end
13
- end
@@ -1,10 +0,0 @@
1
- class RecordLoader < GraphQL::Batch::Loader
2
- def initialize(model)
3
- @model = model
4
- end
5
-
6
- def perform(ids)
7
- @model.where(id: ids).each { |record| fulfill(record.id, record) }
8
- ids.each { |id| fulfill(id, nil) unless fulfilled?(id) }
9
- end
10
- end
@@ -1,18 +0,0 @@
1
- module SoulsHelper
2
- def self.pubsub_queue(topic_name: "seino-schedule-scraper", message: "text!")
3
- pubsub = Google::Cloud::Pubsub.new(project: ENV["PROJECT_ID"])
4
- topic = pubsub.topic(topic_name)
5
- topic.publish(message)
6
- end
7
-
8
- def self.get_tables
9
- path = "./db/schema.rb"
10
- tables = []
11
- File.open(path, "r") do |f|
12
- f.each_line.with_index do |line, _i|
13
- tables << line.split("\"")[1] if line.include?("create_table")
14
- end
15
- end
16
- tables
17
- end
18
- end
@@ -1,32 +0,0 @@
1
- steps:
2
- - name: gcr.io/cloud-builders/docker
3
- args:
4
- - image
5
- - build
6
- - -t
7
- - asia.gcr.io/$PROJECT_ID/$APP_NAME
8
- - .
9
-
10
- - name: gcr.io/cloud-builders/docker
11
- args:
12
- - image
13
- - push
14
- - asia.gcr.io/$PROJECT_ID/$APP_NAME
15
-
16
- - name: gcr.io/cloud-builders/gcloud
17
- args:
18
- - run
19
- - deploy
20
- - $APP_NAME
21
- - --image=asia.gcr.io/$PROJECT_ID/$APP_NAME
22
- - --platform=managed
23
- - --region=asia-northeast1
24
- - --allow-unauthenticated
25
- - --memory=2048Mi
26
- - --concurrency=80
27
- - --port=8080
28
- - --set-cloudsql-instances=$APP_NAME:asia-northeast1:$APP_NAME-db
29
-
30
- timeout: 1600s
31
- options:
32
- machineType: N1_HIGHCPU_8
data/apps/api/config.ru DELETED
@@ -1,17 +0,0 @@
1
- require "./app"
2
- require "rack/cors"
3
- require "graphql_playground"
4
-
5
- map "/playground" do
6
- use GraphQLPlayground, endpoint: "/endpoint"
7
- end
8
-
9
- run SoulsApi
10
-
11
- use Rack::Cors do
12
- allowed_headers = %i[get post put patch delete options head]
13
- allow do
14
- origins "*"
15
- resource "*", headers: :any, methods: allowed_headers
16
- end
17
- end
@@ -1,33 +0,0 @@
1
- default: &default
2
- adapter: postgresql
3
- encoding: utf8
4
- port: 5432
5
-
6
- development:
7
- <<: *default
8
- username: postgres
9
- password: postgres
10
- database: souls-api-dev
11
- host: localhost
12
- port: 5433
13
-
14
- production:
15
- <<: *default
16
- username: <%= ENV.fetch("DB_USER") { "" } %>
17
- database: souls_api_production
18
- password: <%= ENV.fetch("DB_PW") { "" } %>
19
- host: <%= ENV.fetch("DB_HOST") { "" } %>
20
- pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
21
-
22
-
23
- ## Use local docker postgresql13
24
- ## `souls i run_psql` will create psql container
25
-
26
- test:
27
- <<: *default
28
- username: postgres
29
- password: postgres
30
- database: souls-api-test
31
- host: localhost
32
- port: 5433
33
-
@@ -1,10 +0,0 @@
1
- require "souls"
2
- Souls.configure do |config|
3
- config.app = "souls-api"
4
- config.project_id = "souls-api"
5
- config.strain = "api"
6
- config.api_repo = "elsoul/souls_api"
7
- config.worker_repo = "elsoul/souls_worker"
8
- config.worker_endpoint = "https://worker.com"
9
- config.fixed_gems = []
10
- end
@@ -1,71 +0,0 @@
1
- module Constants
2
- def self.areas
3
- # 参考URL 西濃運輸|カンガルー宅急便運賃表
4
- # http://stc.deliveryseino.jp/unchin/unchin.20191001.pdf
5
- {
6
- "北海道": ["北海道"],
7
- "北東北": %w[青森 岩手 秋田],
8
- "南東北": %w[宮城 山形 福島],
9
- "関東": %w[栃木 群馬 新潟 茨城 千葉 東京 神奈川 山梨],
10
- "中部": %w[富山 石川 福井 長野 静岡 愛知 三重 岐阜],
11
- "近畿": %w[滋賀 京都 大阪 奈良 和歌山 兵庫],
12
- "中国": %w[鳥取 岡山 島根 広島 山口],
13
- "四国": %w[香川 徳島 愛媛 高知],
14
- "北九州": %w[福岡 大分 長崎 佐賀],
15
- "南九州": %w[宮崎 熊本 鹿児島],
16
- "沖縄": ["沖縄"]
17
- }
18
- end
19
-
20
- def self.prefectures
21
- %w[
22
- 北海道
23
- 青森県
24
- 岩手県
25
- 宮城県
26
- 秋田県
27
- 山形県
28
- 福島県
29
- 茨城県
30
- 栃木県
31
- 群馬県
32
- 埼玉県
33
- 千葉県
34
- 東京都
35
- 神奈川県
36
- 新潟県
37
- 富山県
38
- 石川県
39
- 福井県
40
- 山梨県
41
- 長野県
42
- 岐阜県
43
- 静岡県
44
- 愛知県
45
- 三重県
46
- 滋賀県
47
- 京都府
48
- 大阪府
49
- 兵庫県
50
- 奈良県
51
- 和歌山県
52
- 鳥取県
53
- 島根県
54
- 岡山県
55
- 広島県
56
- 山口県
57
- 徳島県
58
- 香川県
59
- 愛媛県
60
- 高知県
61
- 福岡県
62
- 佐賀県
63
- 長崎県
64
- 熊本県
65
- 大分県
66
- 宮崎県
67
- 鹿児島県
68
- 沖縄県
69
- ]
70
- end
71
- end
@@ -1,27 +0,0 @@
1
- module Constants
2
- def self.user_columns
3
- {
4
- id: "ID",
5
- uid: "UID",
6
- username: "ユーザー名",
7
- screen_name: "表示名",
8
- last_name: "苗字",
9
- first_name: "名前",
10
- last_name_kanji: "苗字(漢字)",
11
- first_name_kanji: "名前(漢字)",
12
- last_name_kana: "苗字(カナ)",
13
- first_name_kana: "名前(カナ)",
14
- email: "メール",
15
- tel: "電話番号",
16
- icon_url: "アイコンURL",
17
- birthday: "誕生日",
18
- gender: "性別",
19
- lang: "言語",
20
- category: "カテゴリー",
21
- roles_mask: "ユーザー権限",
22
- is_deleted: "削除フラグ",
23
- created_at: "作成日時",
24
- updated_at: "更新日時"
25
- }
26
- end
27
- end
@@ -1,30 +0,0 @@
1
- class CreateUsers < ActiveRecord::Migration[6.1]
2
- def change
3
- create_table :users do |t|
4
- t.string :uid, null: false, unique: true
5
- t.string :username, null: false, default: ""
6
- t.string :screen_name, null: false, default: ""
7
- t.string :last_name, null: false, default: ""
8
- t.string :first_name, null: false, default: ""
9
- t.string :last_name_kanji, null: false, default: ""
10
- t.string :first_name_kanji, null: false, default: ""
11
- t.string :last_name_kana, null: false, default: ""
12
- t.string :first_name_kana, null: false, default: ""
13
- t.string :email, null: false, unique: true
14
- t.string :tel, null: false, default: ""
15
- t.string :icon_url, null: false, default: ""
16
- t.string :birthday, null: false, default: ""
17
- t.string :gender, null: false, default: ""
18
- t.string :lang, null: false, default: "ja"
19
- t.string :category, null: false, default: "user"
20
- t.integer :roles_mask, null: false, default: 1
21
- t.boolean :is_deleted, null: false, default: false
22
- t.timestamps
23
- end
24
- add_index :users, :uid
25
- add_index :users, :screen_name
26
- add_index :users, :email, unique: true
27
- add_index :users, :username
28
- add_index :users, :is_deleted
29
- end
30
- end
@@ -1,12 +0,0 @@
1
- class CreateArticleCategories < ActiveRecord::Migration[6.1]
2
- def change
3
- create_table :article_categories do |t|
4
- t.string :name, null: false
5
- t.text :tags, array: true, default: []
6
- t.boolean :is_deleted, null: false, default: false
7
- t.timestamps
8
- end
9
- add_index :article_categories, :name
10
- add_index :article_categories, :is_deleted
11
- end
12
- end
@@ -1,22 +0,0 @@
1
- class CreateArticles < ActiveRecord::Migration[6.1]
2
- def change
3
- create_table :articles do |t|
4
- t.belongs_to :user
5
- t.string :title, null: false, unique: true
6
- t.text :body, null: false, default: ""
7
- t.string :thumnail_url, null: false, default: ""
8
- t.datetime :public_date, null: false, default: Time.now + 30.days
9
- t.belongs_to :article_category, null: false
10
- t.boolean :is_public, default: false, null: false
11
- t.boolean :just_created, default: true, null: false
12
- t.string :slag, null: false, unique: true
13
- t.text :tags, array: true, default: []
14
- t.boolean :is_deleted, null: false, default: false
15
- t.timestamps
16
- end
17
- add_index :articles, :slag, unique: true
18
- add_index :articles, :title, unique: true
19
- add_index :articles, :is_public
20
- add_index :articles, :is_deleted
21
- end
22
- end
@@ -1,78 +0,0 @@
1
- # This file is auto-generated from the current state of the database. Instead
2
- # of editing this file, please use the migrations feature of Active Record to
3
- # incrementally modify your database, and then regenerate this schema definition.
4
- #
5
- # This file is the source Rails uses to define your schema when running `bin/rails
6
- # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
7
- # be faster and is potentially less error prone than running all of your
8
- # migrations from scratch. Old migrations may fail to apply correctly if those
9
- # migrations use external dependencies or application code.
10
- #
11
- # It's strongly recommended that you check this file into your version control system.
12
-
13
- ActiveRecord::Schema.define(version: 2020_07_14_215521) do
14
-
15
- # These are extensions that must be enabled in order to support this database
16
- enable_extension "plpgsql"
17
-
18
- create_table "article_categories", force: :cascade do |t|
19
- t.string "name", null: false
20
- t.text "tags", default: [], array: true
21
- t.boolean "is_deleted", default: false, null: false
22
- t.datetime "created_at", precision: 6, null: false
23
- t.datetime "updated_at", precision: 6, null: false
24
- t.index ["is_deleted"], name: "index_article_categories_on_is_deleted"
25
- t.index ["name"], name: "index_article_categories_on_name"
26
- end
27
-
28
- create_table "articles", force: :cascade do |t|
29
- t.bigint "user_id"
30
- t.string "title", null: false
31
- t.text "body", default: "", null: false
32
- t.string "thumnail_url", default: "", null: false
33
- t.datetime "public_date", default: "2021-08-18 18:14:54", null: false
34
- t.bigint "article_category_id", null: false
35
- t.boolean "is_public", default: false, null: false
36
- t.boolean "just_created", default: true, null: false
37
- t.string "slag", null: false
38
- t.text "tags", default: [], array: true
39
- t.boolean "is_deleted", default: false, null: false
40
- t.datetime "created_at", precision: 6, null: false
41
- t.datetime "updated_at", precision: 6, null: false
42
- t.index ["article_category_id"], name: "index_articles_on_article_category_id"
43
- t.index ["is_deleted"], name: "index_articles_on_is_deleted"
44
- t.index ["is_public"], name: "index_articles_on_is_public"
45
- t.index ["slag"], name: "index_articles_on_slag", unique: true
46
- t.index ["title"], name: "index_articles_on_title", unique: true
47
- t.index ["user_id"], name: "index_articles_on_user_id"
48
- end
49
-
50
- create_table "users", force: :cascade do |t|
51
- t.string "uid", null: false
52
- t.string "username", default: "", null: false
53
- t.string "screen_name", default: "", null: false
54
- t.string "last_name", default: "", null: false
55
- t.string "first_name", default: "", null: false
56
- t.string "last_name_kanji", default: "", null: false
57
- t.string "first_name_kanji", default: "", null: false
58
- t.string "last_name_kana", default: "", null: false
59
- t.string "first_name_kana", default: "", null: false
60
- t.string "email", null: false
61
- t.string "tel", default: "", null: false
62
- t.string "icon_url", default: "", null: false
63
- t.string "birthday", default: "", null: false
64
- t.string "gender", default: "", null: false
65
- t.string "lang", default: "ja", null: false
66
- t.string "category", default: "user", null: false
67
- t.integer "roles_mask", default: 1, null: false
68
- t.boolean "is_deleted", default: false, null: false
69
- t.datetime "created_at", precision: 6, null: false
70
- t.datetime "updated_at", precision: 6, null: false
71
- t.index ["email"], name: "index_users_on_email", unique: true
72
- t.index ["is_deleted"], name: "index_users_on_is_deleted"
73
- t.index ["screen_name"], name: "index_users_on_screen_name"
74
- t.index ["uid"], name: "index_users_on_uid"
75
- t.index ["username"], name: "index_users_on_username"
76
- end
77
-
78
- end