refile-postgres 1.4.0 → 1.4.1

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
- SHA1:
3
- metadata.gz: 3af65c53e11c0e9bfe133c1f90e96ad49129adab
4
- data.tar.gz: aab1a3e85982632372366006e96757a221da3b62
2
+ SHA256:
3
+ metadata.gz: acc24dbfaf0aea92c0a4daf192480140b44bf69bd98e44044121fdef9ee8af21
4
+ data.tar.gz: bdd9f67e46ffcd05e12b2de112a24c58717ddb7c20ec7d86beef3f021c7611bd
5
5
  SHA512:
6
- metadata.gz: a2183cb351ee8b23d8a428f11777b210f64bc9a29ca644a86282ccb2d834bdce6999a30ca1e744a9f04ee636e3734d58464766e7f28059989f7d52a125c7fd27
7
- data.tar.gz: 30cfa3e996a15e175f80716a23fea44dc81f1c023293de14963e7140233edb84175e38cddd8751c90b222d1605525e2a1051dbba31b76ea33dbc9d79a7ddc05c
6
+ metadata.gz: 03f4e8ef64042d75b19fa12ef88d97ffd876ade77cb642ebac96766f1316aed749f07a09f0a1530653828192b8bd1da398dcefc1068bf9de8c2152fff9ded7e7
7
+ data.tar.gz: cea5a917034efd753269c865ca2a986fc52419455a1153f3a54e8c0af6e26aaa6e1c481aa9ca36c9889b54cef0774e6ca43fd1d4e0d68c8c09f0cd8a813c955c
data/LICENSE.txt CHANGED
@@ -1,6 +1,4 @@
1
- Copyright (c) 2014 Krists Ozols
2
-
3
- MIT License
1
+ Copyright 2019 Krists Ozols
4
2
 
5
3
  Permission is hereby granted, free of charge, to any person obtaining
6
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -23,7 +23,7 @@ A PostgreSQL backend for [Refile](https://github.com/elabs/refile).
23
23
  Add this line to your application's Gemfile:
24
24
 
25
25
  ```ruby
26
- gem 'refile-postgres'
26
+ gem 'refile-postgres', '~> 1.4.0'
27
27
  ```
28
28
 
29
29
  And then execute:
@@ -1,4 +1,4 @@
1
- class Create<%= table_name.camelize %> < ActiveRecord::Migration
1
+ class Create<%= table_name.camelize %> < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  execute %Q{
4
4
  CREATE TABLE <%= table_name %> (
@@ -1,5 +1,5 @@
1
1
  module Refile
2
2
  module Postgres
3
- VERSION = "1.4.0"
3
+ VERSION = "1.4.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,149 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refile-postgres
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krists Ozols
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-28 00:00:00.000000000 Z
11
+ date: 2019-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: refile
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: 0.6.2
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: 0.6.2
27
- - !ruby/object:Gem::Dependency
28
- name: pg
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: bundler
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: webmock
71
15
  requirement: !ruby/object:Gem::Requirement
72
16
  requirements:
73
17
  - - ">="
74
18
  - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: pry
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: pry-stack_explorer
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
19
+ version: '0.6'
20
+ - - "<"
102
21
  - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
22
+ version: '0.8'
23
+ type: :runtime
105
24
  prerelease: false
106
25
  version_requirements: !ruby/object:Gem::Requirement
107
26
  requirements:
108
27
  - - ">="
109
28
  - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: rails
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: 4.2.5
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
29
+ version: '0.6'
30
+ - - "<"
123
31
  - !ruby/object:Gem::Version
124
- version: 4.2.5
32
+ version: '0.8'
125
33
  - !ruby/object:Gem::Dependency
126
- name: rake
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: codeclimate-test-reporter
34
+ name: pg
141
35
  requirement: !ruby/object:Gem::Requirement
142
36
  requirements:
143
37
  - - ">="
144
38
  - !ruby/object:Gem::Version
145
39
  version: '0'
146
- type: :development
40
+ type: :runtime
147
41
  prerelease: false
148
42
  version_requirements: !ruby/object:Gem::Requirement
149
43
  requirements:
@@ -151,21 +45,15 @@ dependencies:
151
45
  - !ruby/object:Gem::Version
152
46
  version: '0'
153
47
  description: Postgres database as a backend for Refile. Uses "Large Objects". See
154
- http://www.postgresql.org/docs/9.3/static/largeobjects.html for more info.
48
+ https://www.postgresql.org/docs/current/largeobjects.html for more info.
155
49
  email:
156
50
  - krists.ozols@gmail.com
157
51
  executables: []
158
52
  extensions: []
159
53
  extra_rdoc_files: []
160
54
  files:
161
- - ".gitignore"
162
- - ".travis.yml"
163
- - Dockerfile
164
- - Gemfile
165
55
  - LICENSE.txt
166
56
  - README.md
167
- - Rakefile
168
- - docker-compose.yml
169
57
  - lib/generators/refile/postgres/initializer/USAGE
170
58
  - lib/generators/refile/postgres/initializer/initializer_generator.rb
171
59
  - lib/generators/refile/postgres/initializer/templates/refile.rb
@@ -177,11 +65,6 @@ files:
177
65
  - lib/refile/postgres/backend/reader.rb
178
66
  - lib/refile/postgres/smart_transaction.rb
179
67
  - lib/refile/postgres/version.rb
180
- - migration_to_1_3_0.md
181
- - postgres-setup
182
- - refile-postgres.gemspec
183
- - spec/refile/postgres/backend_spec.rb
184
- - spec/spec_helper.rb
185
68
  homepage: https://github.com/krists/refile-postgres
186
69
  licenses:
187
70
  - MIT
@@ -201,11 +84,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
84
  - !ruby/object:Gem::Version
202
85
  version: '0'
203
86
  requirements: []
204
- rubyforge_project:
205
- rubygems_version: 2.5.1
87
+ rubygems_version: 3.0.3
206
88
  signing_key:
207
89
  specification_version: 4
208
90
  summary: Postgres database as a backend for Refile
209
- test_files:
210
- - spec/refile/postgres/backend_spec.rb
211
- - spec/spec_helper.rb
91
+ test_files: []
data/.gitignore DELETED
@@ -1,18 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
15
- .ruby-version
16
- .ruby-gemset
17
- .vagrant
18
- berks-cookbooks
data/.travis.yml DELETED
@@ -1,14 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- rvm:
4
- - 2.1.6
5
- - 2.2.2
6
- - 2.3.1
7
- - ruby-head
8
- matrix:
9
- allow_failures:
10
- - rvm: ruby-head
11
- addons:
12
- postgresql: "9.3"
13
- before_script:
14
- - cat $TRAVIS_BUILD_DIR/postgres-setup | psql -U postgres
data/Dockerfile DELETED
@@ -1,16 +0,0 @@
1
- FROM ruby:2.3.0
2
-
3
- RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main" >> /etc/apt/sources.list.d/pgdg.list \
4
- && wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
5
- && apt-get update -qq \
6
- && apt-get install -y build-essential libpq-dev postgresql-client-9.5 postgresql-contrib-9.5
7
-
8
-
9
- ENV APP_PATH=/app BUNDLE_JOBS=4 BUNDLE_RETRY=3 BUNDLE_PATH=/gems
10
-
11
- RUN mkdir ${APP_PATH}
12
- WORKDIR ${APP_PATH}
13
-
14
- ADD . ${APP_PATH}
15
-
16
- CMD bundle check || bundle install; bundle exec rspec spec
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in refile-postgres.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,9 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
3
- begin
4
- require 'rspec/core/rake_task'
5
- RSpec::Core::RakeTask.new(:spec)
6
- task :default => :spec
7
- rescue LoadError
8
- # no rspec available
9
- end
data/docker-compose.yml DELETED
@@ -1,22 +0,0 @@
1
- app:
2
- build: .
3
- links:
4
- - postgres
5
- volumes_from:
6
- - gems
7
- environment:
8
- POSTGRES_HOST: postgres
9
- POSTGRES_PORT: 5432
10
- POSTGRES_DB: refile_test
11
- POSTGRES_USER: refile_postgres_test_user
12
- POSTGRES_PASSWORD: refilepostgres
13
- postgres:
14
- environment:
15
- POSTGRES_USER: refile_postgres_test_user
16
- POSTGRES_PASSWORD: refilepostgres
17
- POSTGRES_DB: refile_test
18
- image: postgres:9.5.1
19
- gems:
20
- image: busybox
21
- volumes:
22
- - /gems
@@ -1,47 +0,0 @@
1
- # Migration to refile-postgres version 1.3.0
2
-
3
- Please check [issue](https://github.com/krists/refile-postgres/issues/9) for more details.
4
-
5
- 1) Change Rails schema dump format to SQL in your `config/application.rb` file
6
- ```ruby
7
- # Use structure.sql instead of schema.rb
8
- config.active_record.schema_format = :sql
9
- ```
10
- 2) Change version number in Gemfile
11
- ```ruby
12
- gem 'refile-postgres', '~> 1.3.0'
13
- ```
14
- 3) Create Rails migration
15
- ```
16
- rails g migration refile_postgres_migration_to_1_3_0
17
- ```
18
- 4) Add content to migration
19
- ```ruby
20
- class RefilePostgresMigrationTo130 < ActiveRecord::Migration
21
- def up
22
- execute <<-SQL
23
- DROP INDEX index_refile_attachments_on_namespace;
24
- ALTER TABLE refile_attachments RENAME TO old_refile_attachments;
25
- ALTER TABLE ONLY old_refile_attachments RENAME CONSTRAINT refile_attachments_pkey TO old_refile_attachments_pkey;
26
- CREATE TABLE refile_attachments (
27
- id integer NOT NULL,
28
- oid oid NOT NULL,
29
- namespace character varying NOT NULL,
30
- created_at timestamp without time zone DEFAULT ('now'::text)::timestamp without time zone
31
- );
32
- ALTER TABLE ONLY refile_attachments ADD CONSTRAINT refile_attachments_pkey PRIMARY KEY (id);
33
- ALTER SEQUENCE refile_attachments_id_seq RESTART OWNED BY refile_attachments.id;
34
- ALTER TABLE ONLY refile_attachments ALTER COLUMN id SET DEFAULT nextval('refile_attachments_id_seq'::regclass);
35
- INSERT INTO refile_attachments (oid, namespace) SELECT id, namespace FROM old_refile_attachments;
36
- CREATE INDEX index_refile_attachments_on_namespace ON refile_attachments USING btree (namespace);
37
- CREATE INDEX index_refile_attachments_on_oid ON refile_attachments USING btree (oid);
38
- DROP TABLE old_refile_attachments;
39
- SQL
40
- end
41
-
42
- def down
43
- raise ActiveRecord::IrreversibleMigration
44
- end
45
- end
46
- ```
47
- 5) Now it is safe to run [vacuumlo](http://www.postgresql.org/docs/9.5/static/vacuumlo.html)
data/postgres-setup DELETED
@@ -1,4 +0,0 @@
1
- DROP DATABASE IF EXISTS refile_test;
2
- DROP ROLE IF EXISTS refile_postgres_test_user;
3
- CREATE ROLE refile_postgres_test_user WITH NOSUPERUSER CREATEDB LOGIN PASSWORD 'refilepostgres';
4
- CREATE DATABASE refile_test WITH OWNER refile_postgres_test_user;
@@ -1,32 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'refile/postgres/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "refile-postgres"
8
- spec.version = Refile::Postgres::VERSION
9
- spec.authors = ["Krists Ozols"]
10
- spec.email = ["krists.ozols@gmail.com"]
11
- spec.summary = %q{Postgres database as a backend for Refile}
12
- spec.description = %q{Postgres database as a backend for Refile. Uses "Large Objects". See http://www.postgresql.org/docs/9.3/static/largeobjects.html for more info.}
13
- spec.homepage = "https://github.com/krists/refile-postgres"
14
- spec.license = "MIT"
15
-
16
- spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_dependency "refile", "~> 0.6.2"
22
- spec.add_dependency "pg"
23
-
24
- spec.add_development_dependency "bundler"
25
- spec.add_development_dependency "rspec"
26
- spec.add_development_dependency "webmock"
27
- spec.add_development_dependency "pry"
28
- spec.add_development_dependency "pry-stack_explorer"
29
- spec.add_development_dependency "rails", "~> 4.2.5"
30
- spec.add_development_dependency "rake"
31
- spec.add_development_dependency "codeclimate-test-reporter"
32
- end
@@ -1,119 +0,0 @@
1
- require "spec_helper"
2
- require "tempfile"
3
-
4
- describe Refile::Postgres::Backend do
5
- let(:connection) { test_connection }
6
- let(:backend) { Refile::Postgres::Backend.new(connection_or_proc, max_size: 100) }
7
-
8
- context "Connection tests" do
9
- context "when not using procs and providing PG::Connection directly" do
10
- let(:connection_or_proc) { connection }
11
- it "reuses the same PG::Connection" do
12
- expect(backend.with_connection { |c| c.db }).to eq(TEST_DB_NAME)
13
- end
14
- end
15
-
16
- context "when using proc" do
17
- context "when lambda does not yield a block but returns connection" do
18
- let(:connection_or_proc) { lambda { connection } }
19
- it "raises argument error" do
20
- expect {
21
- backend.with_connection { |c| c.db }
22
- }.to raise_error(ArgumentError, "When initializing new Refile::Postgres::Backend first argument should be an instance of PG::Connection or a lambda/proc that yields it.")
23
- end
24
- end
25
-
26
- context "when lambda does yield a PG::Connection" do
27
- let(:connection_or_proc) { lambda { |&blk| blk.call(connection) } }
28
- it "is usable in queries" do
29
- expect(backend.with_connection { |c| c.db }).to eq(TEST_DB_NAME)
30
- end
31
- end
32
- end
33
- end
34
-
35
- describe "#registry_table" do
36
- context "when no registry table is present" do
37
- it "raises an exception" do
38
- drop_registry_table
39
- expect {
40
- Refile::Postgres::Backend.new(test_connection, max_size: 100).registry_table
41
- }.to raise_error Refile::Postgres::Backend::RegistryTableDoesNotExistError
42
- end
43
- end
44
-
45
- context "when registry tables exist in multiple schemas" do
46
- before do
47
- test_connection.exec %{
48
- CREATE SCHEMA other_schema;
49
- CREATE TABLE IF NOT EXISTS other_schema.#{Refile::Postgres::Backend::DEFAULT_REGISTRY_TABLE}
50
- ( id serial NOT NULL );
51
- }
52
- end
53
-
54
- after do
55
- test_connection.exec %{
56
- DROP SCHEMA other_schema CASCADE;
57
- }
58
- end
59
-
60
- it "does not raise an exception" do
61
- expect {
62
- Refile::Postgres::Backend.new(test_connection, max_size: 100).registry_table
63
- }.not_to raise_error
64
- end
65
- end
66
- end
67
-
68
- describe "Orphaned large object cleaning" do
69
- let(:connection_or_proc) { test_connection }
70
- let(:backend) { Refile::Postgres::Backend.new(connection_or_proc, max_size: 10000 ) }
71
- it "does not garbage collect attachments after vacuumlo call" do
72
- uploadable = File.open(File.expand_path(__FILE__))
73
- file = backend.upload(uploadable)
74
- expect(backend.exists?(file.id)).to eq(true)
75
- run_vacuumlo
76
- expect(backend.exists?(file.id)).to eq(true)
77
- end
78
- end
79
-
80
- context "Refile Provided tests" do
81
- let(:connection_or_proc) { connection }
82
- it_behaves_like :backend
83
- end
84
-
85
- describe "Content streaming" do
86
- let(:connection_or_proc) { test_connection }
87
- let(:backend) { Refile::Postgres::Backend.new(connection_or_proc, max_size: 1000000 ) }
88
- it "allows to steam large file" do
89
- expect(Refile::Postgres::Backend::Reader::STREAM_CHUNK_SIZE).to eq(16384)
90
- uploadable = Tempfile.new("test-file")
91
- uploadable.write "A" * Refile::Postgres::Backend::Reader::STREAM_CHUNK_SIZE
92
- uploadable.write "B" * Refile::Postgres::Backend::Reader::STREAM_CHUNK_SIZE
93
- uploadable.write "C" * Refile::Postgres::Backend::Reader::STREAM_CHUNK_SIZE
94
- uploadable.close
95
- uploadable.open
96
- file = backend.upload(uploadable)
97
- expect(backend.exists?(file.id)).to eq(true)
98
- reader = backend.open(file.id)
99
- enum = reader.each
100
- expect(enum.next).to eq("A" * Refile::Postgres::Backend::Reader::STREAM_CHUNK_SIZE)
101
- expect(enum.next).to eq("B" * Refile::Postgres::Backend::Reader::STREAM_CHUNK_SIZE)
102
- expect(enum.next).to eq("C" * Refile::Postgres::Backend::Reader::STREAM_CHUNK_SIZE)
103
- expect { enum.next }.to raise_error(StopIteration)
104
- end
105
-
106
- it "allows to steam small file" do
107
- uploadable = Tempfile.new("test-file")
108
- uploadable.write "QWERTY"
109
- uploadable.close
110
- uploadable.open
111
- file = backend.upload(uploadable)
112
- expect(backend.exists?(file.id)).to eq(true)
113
- reader = backend.open(file.id)
114
- enum = reader.each
115
- expect(enum.next).to eq("QWERTY")
116
- expect { enum.next }.to raise_error(StopIteration)
117
- end
118
- end
119
- end
data/spec/spec_helper.rb DELETED
@@ -1,75 +0,0 @@
1
- require "codeclimate-test-reporter"
2
- CodeClimate::TestReporter.start
3
-
4
- $LOAD_PATH.unshift(File.join(Gem::Specification.find_by_name("refile").gem_dir, "spec"))
5
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
-
7
- require "refile/spec_helper"
8
- require "pg"
9
- require "pry"
10
- require "refile/postgres"
11
- require "open3"
12
-
13
- WebMock.disable!(:except => [:codeclimate_test_reporter])
14
-
15
- TEST_DB_NAME = ENV.fetch('POSTGRES_DB', 'refile_test')
16
- TEST_DB_HOST = ENV.fetch('POSTGRES_HOST','localhost')
17
- TEST_DB_USER = ENV.fetch('POSTGRES_USER','refile_postgres_test_user')
18
- TEST_DB_PASSWD = ENV.fetch('POSTGRES_PASSWORD','refilepostgres')
19
- module DatabaseHelpers
20
- def test_connection
21
- @@connection ||= PG.connect(host: TEST_DB_HOST, dbname: TEST_DB_NAME, user: TEST_DB_USER, password: TEST_DB_PASSWD)
22
- end
23
-
24
- def create_registy_table(name = Refile::Postgres::Backend::DEFAULT_REGISTRY_TABLE)
25
- test_connection.exec %Q{
26
- DROP TABLE IF EXISTS #{name};
27
- CREATE TABLE #{name} (
28
- id integer NOT NULL,
29
- oid oid NOT NULL,
30
- namespace character varying NOT NULL,
31
- created_at timestamp without time zone DEFAULT ('now'::text)::timestamp without time zone
32
- );
33
-
34
- CREATE SEQUENCE #{name}_id_seq
35
- START WITH 1
36
- INCREMENT BY 1
37
- NO MINVALUE
38
- NO MAXVALUE
39
- CACHE 1;
40
-
41
- ALTER SEQUENCE #{name}_id_seq OWNED BY #{name}.id;
42
-
43
- ALTER TABLE ONLY #{name} ALTER COLUMN id SET DEFAULT nextval('#{name}_id_seq'::regclass);
44
-
45
- ALTER TABLE ONLY #{name} ADD CONSTRAINT #{name}_pkey PRIMARY KEY (id);
46
-
47
- CREATE INDEX index_#{name}_on_namespace ON #{name} USING btree (namespace);
48
-
49
- CREATE INDEX index_#{name}_on_oid ON #{name} USING btree (oid);
50
- }
51
- end
52
-
53
- def drop_registry_table(name = Refile::Postgres::Backend::DEFAULT_REGISTRY_TABLE)
54
- test_connection.exec %{ DROP TABLE IF EXISTS #{name} CASCADE; }
55
- end
56
-
57
- def run_vacuumlo
58
- command = "export PGPASSWORD=#{TEST_DB_PASSWD}; vacuumlo -h #{TEST_DB_HOST} -U #{TEST_DB_USER} -w -v #{TEST_DB_NAME}"
59
- Open3.popen3(command) do |stdin, stdout, stderr, thread|
60
- stdin.close
61
- IO.copy_stream(stderr, $stderr)
62
- IO.copy_stream(stdout, $stdout)
63
- end
64
- end
65
- end
66
-
67
- RSpec.configure do |config|
68
- config.include DatabaseHelpers
69
-
70
- config.around(:each) do |example|
71
- create_registy_table
72
- example.run
73
- drop_registry_table
74
- end
75
- end