flist 0.1.30 → 0.1.32

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 (44) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +5 -0
  3. data/.rubocop.yml +9 -0
  4. data/.rubocop_todo.yml +110 -0
  5. data/Gemfile +21 -0
  6. data/Rakefile +22 -3
  7. data/SECURITY.md +21 -0
  8. data/bin/console +4 -3
  9. data/config/.gitkeep +0 -0
  10. data/config/db_scheme.yml +71 -0
  11. data/config/db_scheme.yml.sample +48 -0
  12. data/config/dbsetup.rb +55 -0
  13. data/config/opts.rb +9 -0
  14. data/config/opts.rb.sample +7 -0
  15. data/config/setting.yml +2 -0
  16. data/config/sqlite3.yml +26 -0
  17. data/config/tmp/db_scheme.yml +71 -0
  18. data/db/migrate/010_create_countdatetime.rb +13 -0
  19. data/db/migrate/020_create_dirz.rb +12 -0
  20. data/db/migrate/020_create_flistz.rb +24 -0
  21. data/db/migrate/030_create_flistz.rb +22 -0
  22. data/db/migrate/030_create_invalidflistz.rb +14 -0
  23. data/db/migrate/040_create_currentflistz.rb +17 -0
  24. data/db/migrate/040_create_invalidflistz.rb +12 -0
  25. data/db/migrate/050_create_currentflistz.rb +15 -0
  26. data/db/migrate/050_create_dirz.rb +14 -0
  27. data/db/migrate/060_create_invaliddirz.rb +14 -0
  28. data/db/migrate/070_create_currentdirz.rb +17 -0
  29. data/exe/flist +36 -27
  30. data/flist.gemspec +33 -20
  31. data/lib/dbacrecord.rb +37 -0
  32. data/lib/flist/cli.rb +30 -0
  33. data/lib/flist/csvx.rb +26 -0
  34. data/lib/flist/dbutil/dbmgr.rb +17 -24
  35. data/lib/flist/dbutil/dirzmgr.rb +63 -12
  36. data/lib/flist/dbutil/flistzmgr.rb +69 -34
  37. data/lib/flist/dbutil.rb +4 -4
  38. data/lib/flist/flist/filelist.rb +217 -168
  39. data/lib/flist/flist/store.rb +29 -33
  40. data/lib/flist/flist.rb +239 -98
  41. data/lib/flist/version.rb +3 -1
  42. data/lib/flist.rb +16 -5
  43. metadata +126 -32
  44. data/exe/makemigrate +0 -52
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 74954e35dbe3808fe8a56740b5ac175d23352dc6
4
- data.tar.gz: 8304a1b252e2bddb3e0c8da9cc725dc62fce8c32
2
+ SHA256:
3
+ metadata.gz: 80e7ec0fbf6850f7f3b9b5b3ceca1c4c4a11b2c8b74a423c2f8c1b3f49a59b0e
4
+ data.tar.gz: '093504b47a1c64d03c614824c5de93a2ad65b3bda0259b9d17ea8dfe30260820'
5
5
  SHA512:
6
- metadata.gz: 21df6f570883e78784888d41f5018d7dfad5f6a1f5d64cca97cb1d5adc5594e4faf82d7934eb0f3ee0a7c21afa99d6ba4e68d9464eeccd5d6dee4072d405000b
7
- data.tar.gz: e86f66c766f38f3517cc6d4fb4ede4f71b334e8de185b5a416376e8ae2d7df06b0d4789c9fffdfe6beb1e036774d8fcc9aa3f6df7c1bbf3f853db558e77ba13e
6
+ metadata.gz: 3e8316a22176851509c7efb0e819847df4e17bcdb1e925a760962d8eb1a54245f19023d9908d2bda10c4791c3aee1e03201fb968b2d8a8adf5752b5da742ecc8
7
+ data.tar.gz: bbbbb98cb399d2025db71b4a4e4f3bf7d8615fe88d491865367fa56cb6225c52be5dada3047c9ac108b10ae4358a41484f6c9fa8835b644e21c98eaf1b93d05a
data/.gitignore CHANGED
@@ -1,3 +1,8 @@
1
+ db/production.sqlite3
2
+ db/sqlite3-database.log
3
+ flist-gem.code-workspace
4
+ /vendor/
5
+ .ruby-version
1
6
  /.bundle/
2
7
  /.yardoc
3
8
  /Gemfile.lock
data/.rubocop.yml ADDED
@@ -0,0 +1,9 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 2.7
5
+ NewCops: enable
6
+
7
+ require:
8
+ - rubocop-rake
9
+ - rubocop-rspec
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,110 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2022-09-28 00:57:30 UTC using RuboCop version 1.36.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 2
10
+ Lint/HashCompareByIdentity:
11
+ Exclude:
12
+ - 'lib/flist/dbutil/dirzmgr.rb'
13
+ - 'lib/flist/dbutil/flistzmgr.rb'
14
+
15
+ # Offense count: 1
16
+ Lint/UnreachableCode:
17
+ Exclude:
18
+ # - 'lib/flist/flist/filelist.rb'
19
+
20
+ # Offense count: 8
21
+ Lint/UselessAssignment:
22
+ Exclude:
23
+ # - 'exe/flist'
24
+ # - 'lib/flist/dbutil/flistzmgr.rb'
25
+ # - 'lib/flist/flist.rb'
26
+ # - 'lib/flist/flist/filelist.rb'
27
+
28
+ # Offense count: 14
29
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
30
+ Metrics/AbcSize:
31
+ Max: 61
32
+
33
+ # Offense count: 1
34
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods, inherit_mode.
35
+ # AllowedMethods: refine
36
+ Metrics/BlockLength:
37
+ Max: 32
38
+
39
+ # Offense count: 2
40
+ # Configuration parameters: CountComments, CountAsOne.
41
+ Metrics/ClassLength:
42
+ Max: 258
43
+
44
+ # Offense count: 2
45
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
46
+ Metrics/CyclomaticComplexity:
47
+ Max: 10
48
+
49
+ # Offense count: 19
50
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
51
+ Metrics/MethodLength:
52
+ Max: 47
53
+
54
+ # Offense count: 7
55
+ # Configuration parameters: CountKeywordArgs.
56
+ Metrics/ParameterLists:
57
+ Max: 11
58
+ MaxOptionalParameters: 11
59
+
60
+ # Offense count: 2
61
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
62
+ Metrics/PerceivedComplexity:
63
+ Max: 10
64
+
65
+ # Offense count: 1
66
+ Naming/AccessorMethodName:
67
+ Exclude:
68
+ # - 'lib/flist/flist/filelist.rb'
69
+
70
+ # Offense count: 1
71
+ # Configuration parameters: EnforcedStyle, AllowedPatterns, IgnoredPatterns.
72
+ # SupportedStyles: snake_case, camelCase
73
+ Naming/MethodName:
74
+ Exclude: # - 'lib/_arx_flistz.rb'
75
+
76
+ # Offense count: 5
77
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
78
+ # AllowedNames: as, at, by, db, id, in, io, ip, of, on, os, pp, to
79
+ Naming/MethodParameterName:
80
+ Exclude:
81
+ # - 'lib/flist/flist.rb'
82
+ # - 'lib/flist/flist/filelist.rb'
83
+ # - 'lib/flist/flist/store.rb'
84
+
85
+ # Offense count: 17
86
+ # Configuration parameters: AllowedConstants.
87
+ Style/Documentation:
88
+ Enabled: false
89
+
90
+ # Offense count: 4
91
+ # Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
92
+ Style/GuardClause:
93
+ Exclude:
94
+ # - 'flist.gemspec'
95
+ # - 'lib/flist/csvx.rb'
96
+ # - 'lib/flist/dbutil/flistzmgr.rb'
97
+ # - 'lib/flist/flist/filelist.rb'
98
+
99
+ # Offense count: 1
100
+ # This cop supports safe autocorrection (--autocorrect).
101
+ Style/IfUnlessModifier:
102
+ Exclude:
103
+ # - 'lib/flist/flist/filelist.rb'
104
+
105
+ # Offense count: 1
106
+ # This cop supports safe autocorrection (--autocorrect).
107
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
108
+ # URISchemes: http, https
109
+ Layout/LineLength:
110
+ Max: 159
data/Gemfile CHANGED
@@ -1,6 +1,27 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in flist.gemspec
4
6
  gemspec
5
7
 
8
+ gem 'bundler'
9
+
10
+ ######
11
+ gem 'arxutils_sqlite3'
12
+ gem 'encx'
13
+ gem 'evernote_oauth'
14
+ gem 'ykxutils'
15
+
16
+ gem 'ykutils', '> 0.1.3'
17
+
18
+ gem 'rake', '~> 13.0'
19
+ gem 'rspec', '~> 3.0'
20
+
21
+ gem 'rubocop', '~> 1.7'
22
+ gem 'rubocop-rake'
23
+ gem 'rubocop-rspec'
6
24
 
25
+ group :development do
26
+ gem 'yard'
27
+ end
data/Rakefile CHANGED
@@ -1,6 +1,25 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'flist'
4
+ require 'arxutils_sqlite3/rake_task'
5
+
6
+ require 'bundler/gem_tasks'
7
+ require 'rspec/core/rake_task'
8
+ # require "rubocop"
3
9
 
4
10
  RSpec::Core::RakeTask.new(:spec)
5
11
 
6
- task :default => :spec
12
+ require 'rubocop/rake_task'
13
+
14
+ RuboCop::RakeTask.new
15
+
16
+ # task :default => :spec
17
+ desc 'Flist related operation'
18
+ task :flist do
19
+ sh 'bundle exec exe/flist'
20
+ end
21
+
22
+ desc 'Flist related operation'
23
+ task default: %i[spec rubocop]
24
+
25
+ # task :default => :spec
data/SECURITY.md ADDED
@@ -0,0 +1,21 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ Use this section to tell people about which versions of your project are
6
+ currently being supported with security updates.
7
+
8
+ | Version | Supported |
9
+ | ------- | ------------------ |
10
+ | 5.1.x | :white_check_mark: |
11
+ | 5.0.x | :x: |
12
+ | 4.0.x | :white_check_mark: |
13
+ | < 4.0 | :x: |
14
+
15
+ ## Reporting a Vulnerability
16
+
17
+ Use this section to tell people how to report a vulnerability.
18
+
19
+ Tell them where to go, how often they can expect to get an update on a
20
+ reported vulnerability, what to expect if the vulnerability is accepted or
21
+ declined, etc.
data/bin/console CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "flist"
4
+ require 'bundler/setup'
5
+ require 'flist'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +11,5 @@ require "flist"
10
11
  # require "pry"
11
12
  # Pry.start
12
13
 
13
- require "irb"
14
+ require 'irb'
14
15
  IRB.start
data/config/.gitkeep ADDED
File without changes
@@ -0,0 +1,71 @@
1
+ ---
2
+ - :flist:
3
+ - noitem
4
+ :classname: Countdatetime
5
+ :classname_downcase: countdatetime
6
+ :items:
7
+ - - countdatetime
8
+ - datetime
9
+ - 'false'
10
+ :plural: countdatetimes
11
+ :ar_version: 6.0
12
+ - :flist:
13
+ - noitem
14
+ - invalid
15
+ - current
16
+ :classname: Flistz
17
+ :classname_downcase: flistz
18
+ :items:
19
+ - - dir_id
20
+ - integer
21
+ - 'false'
22
+ - - level
23
+ - integer
24
+ - 'false'
25
+ - - kind
26
+ - string
27
+ - 'false'
28
+ - - repo
29
+ - string
30
+ - 'false'
31
+ - - path
32
+ - string
33
+ - 'false'
34
+ - - project
35
+ - string
36
+ - 'false'
37
+ - - desc
38
+ - string
39
+ - 'true'
40
+ - - comment
41
+ - string
42
+ - 'true'
43
+ - - atime
44
+ - datetime
45
+ - 'false'
46
+ - - ctime
47
+ - datetime
48
+ - 'false'
49
+ - - mtime
50
+ - datetime
51
+ - 'false'
52
+ - - start_datetime
53
+ - datetime
54
+ - 'false'
55
+ :plural: Flistzs
56
+ :ar_version: 6.0
57
+ - :flist:
58
+ - noitem
59
+ - invalid
60
+ - current
61
+ :classname: Dirz
62
+ :classname_downcase: dirz
63
+ :items:
64
+ - - path
65
+ - string
66
+ - 'false'
67
+ - - start_datetime
68
+ - datetime
69
+ - 'false'
70
+ :plural: Dirzs
71
+ :ar_version: 6.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ - :flist:
3
+ - noitem
4
+ :classname: Countdatetime
5
+ :classname_downcase: countdatetime
6
+ :items:
7
+ - - countdatetime
8
+ - datetime
9
+ - 'false'
10
+ :plural: countdatetimes
11
+ :ar_version: 6.0
12
+ - :flist:
13
+ - noitem
14
+ :classname: Flist
15
+ :classname_downcase: flist
16
+ :items:
17
+ - - time_id
18
+ - integer
19
+ - 'false'
20
+ - - ennb_id
21
+ - integer
22
+ - 'false'
23
+ :plural: flists
24
+ :ar_version: 6.0
25
+ - :flist:
26
+ - noitem
27
+ - invalid
28
+ - current
29
+ :classname: Flistlist
30
+ :classname_downcase: flistlist
31
+ :items:
32
+ - - stack
33
+ - string
34
+ - 'false'
35
+ - - notebook
36
+ - string
37
+ - 'false'
38
+ - - count
39
+ - integer
40
+ - 'false'
41
+ - - tag_count
42
+ - integer
43
+ - 'false'
44
+ - - start_datetime
45
+ - datetime
46
+ - 'false'
47
+ :plural: flistlists
48
+ :ar_version: 6.0
data/config/dbsetup.rb ADDED
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../lib/dbacrecord'
4
+
5
+ class Dbsetup
6
+ def initialize(connect_time)
7
+ @connect_time = connect_time
8
+ @ct = Flist::Dbutil::Countdatetime.create(countdatetime: @connect_time)
9
+ @hs_by_notebook = {}
10
+ @hs_by_id = {}
11
+ end
12
+ # # 指定stack(文字列)にノートブック(文字列)、ノートブック数、タグ数を追加
13
+ # def add( stack , notebook, count, tag_count )
14
+ # ennblist = @hs_by_notebook[notebook]
15
+ # unless ennblist
16
+ # cur_ennblist = Currentennblist.where( notebook: notebook ).limit(1)
17
+ # if cur_ennblist.size == 0
18
+ # begin
19
+ # ennblist = Ennblist.create( stack: stack, notebook: notebook ,
20
+ # count: count, tag_count: tag_count ,
21
+ # start_datetime: @register_time )
22
+ # evnb = Evnb.create( time_id: @ct.id , ennb_id: ennblist.id )
23
+ # rescue => ex
24
+ # p ex.class
25
+ # p ex.message
26
+ # pp ex.backtrace
27
+ #
28
+ # ennblist = nil
29
+ # evnb = nil
30
+ # end
31
+ # else
32
+ # current_ennblist = cur_ennblist.first.ennblist
33
+ # hs = {:stack => stack, :count => count , :tag_count => tag_count }
34
+ # value_hs = hs.reduce({}){ |hsx,item|
35
+ # if current_ennblist[ item[0] ] != item[1]
36
+ # hsx[ item[0] ] = item[1]
37
+ # end
38
+ # hsx
39
+ # }
40
+ # if value_hs.size > 0
41
+ # if value_hs.all? { |item| item[1] != nil }
42
+ # current_ennblist.update(value_hs)
43
+ # end
44
+ # end
45
+ # end
46
+ # else
47
+ # # ignore this case.
48
+ # end
49
+ # if ennblist
50
+ # @hs_by_notebook[notebook] = ennblist
51
+ # @hs_by_id[ennblist.id] = ennblist
52
+ # end
53
+ # ennblist
54
+ # end
55
+ end
data/config/opts.rb ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ @opts = {
4
+ acrecord: {
5
+ module: %w[Flist Dbutil],
6
+ filename: 'dbacrecord.rb',
7
+ dir: 'lib'
8
+ }
9
+ }
@@ -0,0 +1,7 @@
1
+ @opts = {
2
+ acrecord: {
3
+ module: %w[Flist Dbutil],
4
+ filename: "dbacrecord.rb",
5
+ dir: "lib"
6
+ }
7
+ }
@@ -0,0 +1,2 @@
1
+ ---
2
+ :mod: Flist
@@ -0,0 +1,26 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ #
7
+ default_env: &default
8
+ adapter: sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+ database: db/production.sqlite3
12
+
13
+ development:
14
+ <<: *default
15
+ database: db/development.sqlite3
16
+
17
+ # Warning: The database defined as "test" will be erased and
18
+ # re-generated from your development database when you run "rake".
19
+ # Do not set this db to the same as development or production.
20
+ test:
21
+ <<: *default
22
+ database: db/test.sqlite3
23
+
24
+ production:
25
+ <<: *default
26
+ database: db/production.sqlite3
@@ -0,0 +1,71 @@
1
+ ---
2
+ - :flist:
3
+ - noitem
4
+ :classname: Countdatetime
5
+ :classname_downcase: countdatetime
6
+ :items:
7
+ - - countdatetime
8
+ - datetime
9
+ - 'false'
10
+ :plural: countdatetimes
11
+ :ar_version: 6.0
12
+ - :flist:
13
+ - noitem
14
+ - invalid
15
+ - current
16
+ :classname: Flistz
17
+ :classname_downcase: flistz
18
+ :items:
19
+ - - dir_id
20
+ - integer
21
+ - 'false'
22
+ - - level
23
+ - integer
24
+ - 'false'
25
+ - - kind
26
+ - string
27
+ - 'false'
28
+ - - repo
29
+ - string
30
+ - 'false'
31
+ - - path
32
+ - string
33
+ - 'false'
34
+ - - project
35
+ - string
36
+ - 'false'
37
+ - - desc
38
+ - string
39
+ - 'true'
40
+ - - comment
41
+ - string
42
+ - 'true'
43
+ - - a_time
44
+ - datetime
45
+ - 'false'
46
+ - - c_time
47
+ - datetime
48
+ - 'false'
49
+ - - m_time
50
+ - datetime
51
+ - 'false'
52
+ - - start_datetime
53
+ - datetime
54
+ - 'false'
55
+ :plural: Flistzs
56
+ :ar_version: 6.0
57
+ - :flist:
58
+ - noitem
59
+ - invalid
60
+ - current
61
+ :classname: Dirz
62
+ :classname_downcase: dirz
63
+ :items:
64
+ - - path
65
+ - string
66
+ - 'false'
67
+ - - start_datetime
68
+ - datetime
69
+ - 'false'
70
+ :plural: Dirzs
71
+ :ar_version: 6.0
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateCountdatetime < ActiveRecord::Migration[6.0]
4
+ def self.up
5
+ create_table :countdatetimes do |t|
6
+ t.column :countdatetime, :datetime, null: false
7
+ end
8
+ end
9
+
10
+ def self.down
11
+ drop_table :countdatetimes
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ class CreateDirz < ActiveRecord::Migration[6.0]
2
+ def self.up
3
+ create_table :dirzs do |t|
4
+ t.column :path, :string, :null => false
5
+ t.column :start_datetime, :datetime, :null => false
6
+ end
7
+ end
8
+
9
+ def self.down
10
+ drop_table :dirzs
11
+ end
12
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateFlistz < ActiveRecord::Migration[6.0]
4
+ def self.up
5
+ create_table :Flistzs do |t|
6
+ t.column :dir_id, :integer, null: false
7
+ t.column :level, :integer, null: false
8
+ t.column :kind, :string, null: false
9
+ t.column :repo, :string, null: false
10
+ t.column :path, :string, null: false
11
+ t.column :project, :string, null: false
12
+ t.column :desc, :string, null: true
13
+ t.column :comment, :string, null: true
14
+ t.column :atime, :datetime, null: false
15
+ t.column :ctime, :datetime, null: false
16
+ t.column :mtime, :datetime, null: false
17
+ t.column :start_datetime, :datetime, null: false
18
+ end
19
+ end
20
+
21
+ def self.down
22
+ drop_table :Flistzs
23
+ end
24
+ end
@@ -0,0 +1,22 @@
1
+ class CreateFlistz < ActiveRecord::Migration[6.0]
2
+ def self.up
3
+ create_table :flistzs do |t|
4
+ t.column :dir_id, :integer, :null => false
5
+ t.column :level, :integer, :null => false
6
+ t.column :kind, :string, :null => false
7
+ t.column :repo, :string, :null => false
8
+ t.column :path, :string, :null => false
9
+ t.column :project, :string, :null => false
10
+ t.column :desc, :string, :null => false
11
+ t.column :comment, :string, :null => false
12
+ t.column :atime, :datetime, :null => false
13
+ t.column :ctime, :datetime, :null => false
14
+ t.column :mtime, :datetime, :null => false
15
+ t.column :start_datetime, :datetime, :null => false
16
+ end
17
+ end
18
+
19
+ def self.down
20
+ drop_table :flistzs
21
+ end
22
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateInvalidflistz < ActiveRecord::Migration[6.0]
4
+ def self.up
5
+ create_table :invalidFlistzs do |t|
6
+ t.column :org_id, :int, null: false
7
+ t.column :count_id, :int, null: true
8
+ end
9
+ end
10
+
11
+ def self.down
12
+ drop_table :invalidFlistzs
13
+ end
14
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateCurrentflistz < ActiveRecord::Migration[6.0]
4
+ def self.up
5
+ execute <<~SQL
6
+ CREATE VIEW currentFlistzs AS SELECT id as org_id,
7
+ dir_id , level , kind , repo , path , project , desc , comment , atime , ctime , mtime , start_datetime
8
+ FROM Flistzs where not exists (select * from invalidFlistzs where invalidFlistzs.org_id = Flistzs.id )
9
+ SQL
10
+ end
11
+
12
+ def self.down
13
+ execute <<-SQL
14
+ DROP VIEW currentFlistzs
15
+ SQL
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ class CreateInvalidflistz < ActiveRecord::Migration[6.0]
2
+ def self.up
3
+ create_table :invalidflistzs do |t|
4
+ t.column :org_id, :int, :null => false
5
+ t.column :count_id, :int, :null => true
6
+ end
7
+ end
8
+
9
+ def self.down
10
+ drop_table :invalidflistzs
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ class CreateCurrentflistz < ActiveRecord::Migration[6.0]
2
+ def self.up
3
+ execute <<-SQL
4
+ CREATE VIEW currentflistzs AS SELECT id as org_id,
5
+ dir_id , level , kind , repo , path , project , desc , comment , atime , ctime , mtime , start_datetime
6
+ FROM flistzs where not exists (select * from invalidflistzs where invalidflistzs.org_id = flistzs.id )
7
+ SQL
8
+ end
9
+
10
+ def self.down
11
+ execute <<-SQL
12
+ DROP VIEW currentflistzs
13
+ SQL
14
+ end
15
+ end