sequel_tools 0.1.11 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d598579322a3645ebc25cdf804f53b478016a68a6c479b30d46e30ce6019cf2
4
- data.tar.gz: 82f122492e419faf2b9a03ca463ab79593eafdb689186e66d61de0a8a4873489
3
+ metadata.gz: dbc03d963faeda496049e1e3a8cc111bb68a18eeca2986b9b18a872280c6520a
4
+ data.tar.gz: c498ec036d519fcc585e39c7dd32af341884138b108bf0baf08e7f5da73cd0bb
5
5
  SHA512:
6
- metadata.gz: 7e40f95a57ef0b23e708e5060f517b98bd6a774622afa61c64e2d3f77dd39ed8a5fcc61ddcd3cac38c8756fb24f8f0b99ca963277eaf89182d20e00ac73ab8d3
7
- data.tar.gz: 23830ae52f9c3518eb5bce1fe9b471906e1e45e04ba58fb3efe88b170e32399c59d96625ad5abd6b710355cab9675c60f473f7d1fc5a24eb447aeb342c322726
6
+ metadata.gz: 65dc15bc47c0eba4f5fa067bc8ee521bebe3926a7e423e3dd9d1b7b5bda0ea65ea2cb925edc41ceac8e9e762df276873f92ce00a0687638e0e42b347b7c4d076
7
+ data.tar.gz: 84a43de92472aaca2c48814b2a92f8305711103bc4c402d31e8ddc5fd3e6047ec1b11e3a70f408fae2f1a10e7d0665befaba7ec346db1b9ae5c9dc330bdc32ca
data/README.md CHANGED
@@ -40,8 +40,8 @@ Here's a sample Rakefile supporting migrate actions:
40
40
  require 'bundler/setup'
41
41
  require 'sequel_tools'
42
42
 
43
- base_config = SequelTools.base_config(
44
- project_root: File.expand_path(__dir__),
43
+ base_config = {
44
+ # project_root: Dir.pwd,
45
45
  dbadapter: 'postgres',
46
46
  dbname: 'mydb',
47
47
  username: 'myuser',
@@ -63,7 +63,14 @@ base_config = SequelTools.base_config(
63
63
  # when nil, defaults to the value of the :dbadapter config.
64
64
  # This is the database we should connect to before executing "create database dbname"
65
65
  maintenancedb: :default,
66
- )
66
+ # migrations_table: 'schema_migrations',
67
+ # allow other tables data to be included in the dump file generated by rake db:schema_dump
68
+ # extra_tables_in_dump: nil
69
+ # for example, if you want to keep migrations from ActiveRecord in the dump file, while using
70
+ # another table for Sequel migrations:
71
+ # migrations_table: 'sequel_schema_migrations',
72
+ # extra_tables_in_dump: ['schema_migrations'],
73
+ }
67
74
 
68
75
  namespace 'db' do
69
76
  SequelTools.inject_rake_tasks base_config.merge(dump_schema_on_migrate: true), self
@@ -15,8 +15,11 @@ class SequelTools::ActionsManager
15
15
  migrations_table = c[:migrations_table]
16
16
  if (migrations_table ? content.include?(migrations_table) :
17
17
  (content =~ /schema_(migrations|info)/))
18
- table_options = migrations_table ? "-t #{migrations_table}" :
19
- '-t schema_migrations -t schema_info'
18
+ include_tables = migrations_table ? [migrations_table] :
19
+ ['schema_migrations', 'schema_info']
20
+ extra_tables = c[:extra_tables_in_dump]
21
+ include_tables.concat extra_tables if extra_tables
22
+ table_options = include_tables.map{|t| "-t #{t}"}.join(' ')
20
23
  stdout, stderr, success =
21
24
  PgHelper.run_pg_command c, "#{pg_dump} -a #{table_options} --inserts"
22
25
  unless success
@@ -1,5 +1,5 @@
1
1
  # frozen-string-literal: true
2
2
 
3
3
  module SequelTools
4
- VERSION = '0.1.11'
4
+ VERSION = '0.1.13'
5
5
  end
data/lib/sequel_tools.rb CHANGED
@@ -4,7 +4,7 @@ require 'sequel_tools/version'
4
4
 
5
5
  module SequelTools
6
6
  DEFAULT_CONFIG = {
7
- project_root: nil,
7
+ project_root: Dir.pwd,
8
8
  pg_dump: 'pg_dump', # command used to run pg_dump
9
9
  psql: 'psql', # command used to run psql
10
10
  maintenancedb: :default, # DB to connect to for creating/dropping databases
@@ -21,9 +21,10 @@ module SequelTools
21
21
  log_level: nil,
22
22
  sql_log_level: :debug,
23
23
  migrations_table: nil,
24
+ extra_tables_in_dump: nil,
24
25
  } # unfrozen on purpose so that one might want to update the defaults
25
26
 
26
- REQUIRED_KEYS = [ :project_root, :dbadapter, :dbname, :username ]
27
+ REQUIRED_KEYS = [ :dbadapter, :dbname, :username ]
27
28
  class MissingConfigError < StandardError; end
28
29
  def self.base_config(extra_config = {})
29
30
  config = DEFAULT_CONFIG.merge extra_config
@@ -39,7 +40,7 @@ module SequelTools
39
40
  def self.inject_rake_tasks(config = {}, rake_context)
40
41
  require_relative 'sequel_tools/actions_manager'
41
42
  require_relative 'sequel_tools/all_actions'
42
- actions_manager = ActionsManager.new config
43
+ actions_manager = ActionsManager.new base_config(config)
43
44
  actions_manager.load_all
44
45
  actions_manager.export_as_rake_tasks rake_context
45
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Rosenfeld Rosas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-05 00:00:00.000000000 Z
11
+ date: 2022-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel