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 +4 -4
- data/README.md +10 -3
- data/lib/sequel_tools/actions/schema_dump_postgres.rb +5 -2
- data/lib/sequel_tools/version.rb +1 -1
- data/lib/sequel_tools.rb +4 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbc03d963faeda496049e1e3a8cc111bb68a18eeca2986b9b18a872280c6520a
|
4
|
+
data.tar.gz: c498ec036d519fcc585e39c7dd32af341884138b108bf0baf08e7f5da73cd0bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
44
|
-
project_root:
|
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
|
-
|
19
|
-
'
|
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
|
data/lib/sequel_tools/version.rb
CHANGED
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:
|
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 = [ :
|
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.
|
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-
|
11
|
+
date: 2022-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|