ar-sequence 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +4 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +41 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +38 -0
- data/.github/dependabot.yml +15 -0
- data/.github/workflows/tests.yml +72 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +25 -0
- data/.travis.yml +17 -16
- data/CHANGELOG.md +30 -3
- data/CODE_OF_CONDUCT.md +68 -7
- data/CONTRIBUTING.md +79 -0
- data/Gemfile +2 -1
- data/LICENSE.md +20 -0
- data/README.md +39 -29
- data/Rakefile +6 -3
- data/ar-sequence.gemspec +9 -4
- data/bin/console +16 -0
- data/bin/setup +10 -0
- data/gemfiles/6_0.gemfile +6 -0
- data/gemfiles/6_1.gemfile +6 -0
- data/gemfiles/7_0.gemfile +6 -0
- data/lib/ar/sequence/adapter.rb +21 -3
- data/lib/ar/sequence/command_recorder.rb +2 -0
- data/lib/ar/sequence/model_methods.rb +2 -0
- data/lib/ar/sequence/schema_dumper.rb +40 -4
- data/lib/ar/sequence/version.rb +3 -1
- data/lib/ar/sequence.rb +8 -4
- data/lib/ar-sequence.rb +2 -0
- metadata +42 -21
- data/LICENSE.txt +0 -21
- data/gemfiles/activerecord_5_0.Gemfile.lock +0 -77
- data/gemfiles/activerecord_5_0.gemfile +0 -4
- data/gemfiles/activerecord_5_1.Gemfile.lock +0 -77
- data/gemfiles/activerecord_5_1.gemfile +0 -4
- data/gemfiles/activerecord_5_2.gemfile +0 -4
- data/gemfiles/activerecord_5_2.gemfile.lock +0 -77
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31fd2b32e3b380066c4a9a8a50fa84ed0c880aaec06da39ead297f2d195ac382
|
4
|
+
data.tar.gz: 747332c2d4f177a524dbd212ff4e4f710812c97bf7e409efa5df571963d83de9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2b5de771db2981bf6ee1403b2a96cee69065434c978e1f09a1a210998d63d8bfd33096620fbf82685409d48222a794e166f3409d1edea73a8333fc241e92c96
|
7
|
+
data.tar.gz: 91d0005d29df02998ce1213371dddd75db069f10204349b18456cef296082f4ac2aa33a247b061a0f54d6a001fe9d689b1c4d0df9c67610067cc09a8e1da32b4
|
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
---
|
2
|
+
name: "🐛 Bug Report"
|
3
|
+
about: Report a reproducible bug or regression.
|
4
|
+
title: 'Bug: '
|
5
|
+
labels: 'Status: Unconfirmed'
|
6
|
+
|
7
|
+
---
|
8
|
+
|
9
|
+
<!--
|
10
|
+
- Please provide a clear and concise description of what the bug is.
|
11
|
+
- If possible, add an example reproducing your issue.
|
12
|
+
- Please test using the latest version of ar-sequence
|
13
|
+
to make sure your issue has not already been fixed.
|
14
|
+
-->
|
15
|
+
|
16
|
+
## Description
|
17
|
+
|
18
|
+
[Add bug description here]
|
19
|
+
|
20
|
+
## How to reproduce
|
21
|
+
|
22
|
+
[Add steps on how to reproduce this issue]
|
23
|
+
|
24
|
+
## What do you expect
|
25
|
+
|
26
|
+
[Describe what do you expect to happen]
|
27
|
+
|
28
|
+
## What happened instead
|
29
|
+
|
30
|
+
[Describe the actual results]
|
31
|
+
|
32
|
+
## Software:
|
33
|
+
|
34
|
+
- Gem version: [Add gem version here]
|
35
|
+
- Ruby version: [Add version here]
|
36
|
+
|
37
|
+
## Full backtrace
|
38
|
+
|
39
|
+
```text
|
40
|
+
[Paste full backtrace here]
|
41
|
+
```
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
name: "💡 Feature request"
|
3
|
+
about: Have an idea that may be useful? Make a suggestion!
|
4
|
+
title: 'Feature Request: '
|
5
|
+
labels: 'Feature request'
|
6
|
+
|
7
|
+
---
|
8
|
+
|
9
|
+
## Description
|
10
|
+
|
11
|
+
_A clear and concise description of what the problem is._
|
12
|
+
|
13
|
+
## Describe the solution
|
14
|
+
|
15
|
+
_A clear and concise description of what you want to happen._
|
16
|
+
|
17
|
+
## Alternatives you considered
|
18
|
+
|
19
|
+
_A clear and concise description of any alternative solutions or features you've considered._
|
20
|
+
|
21
|
+
## Additional context
|
22
|
+
|
23
|
+
_Add any other context, screenshots, links, etc about the feature request here._
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<!--
|
2
|
+
If you're making a doc PR or something tiny where the below is irrelevant,
|
3
|
+
delete this template and use a short description, but in your description aim to
|
4
|
+
include both what the change is, and why it is being made, with enough context
|
5
|
+
for anyone to understand.
|
6
|
+
-->
|
7
|
+
|
8
|
+
<details>
|
9
|
+
<summary>PR Checklist</summary>
|
10
|
+
|
11
|
+
### PR Structure
|
12
|
+
|
13
|
+
- [ ] This PR has reasonably narrow scope (if not, break it down into smaller
|
14
|
+
PRs).
|
15
|
+
- [ ] This PR avoids mixing refactoring changes with feature changes (split into
|
16
|
+
two PRs otherwise).
|
17
|
+
- [ ] This PR's title starts is concise and descriptive.
|
18
|
+
|
19
|
+
### Thoroughness
|
20
|
+
|
21
|
+
- [ ] This PR adds tests for the most critical parts of the new functionality or
|
22
|
+
fixes.
|
23
|
+
- [ ] I've updated any docs, `.md` files, etc… affected by this change.
|
24
|
+
|
25
|
+
</details>
|
26
|
+
|
27
|
+
### What
|
28
|
+
|
29
|
+
[TODO: Short statement about what is changing.]
|
30
|
+
|
31
|
+
### Why
|
32
|
+
|
33
|
+
[TODO: Why this change is being made. Include any context required to understand
|
34
|
+
the why.]
|
35
|
+
|
36
|
+
### Known limitations
|
37
|
+
|
38
|
+
[TODO or N/A]
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
# Documentation:
|
3
|
+
# https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates
|
4
|
+
|
5
|
+
version: 2
|
6
|
+
updates:
|
7
|
+
- package-ecosystem: "github-actions"
|
8
|
+
directory: "/"
|
9
|
+
schedule:
|
10
|
+
interval: "daily"
|
11
|
+
|
12
|
+
- package-ecosystem: "bundler"
|
13
|
+
directory: "/"
|
14
|
+
schedule:
|
15
|
+
interval: "daily"
|
@@ -0,0 +1,72 @@
|
|
1
|
+
---
|
2
|
+
name: Tests
|
3
|
+
|
4
|
+
on:
|
5
|
+
pull_request:
|
6
|
+
push:
|
7
|
+
workflow_dispatch:
|
8
|
+
inputs: {}
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
build:
|
12
|
+
name: Tests with Ruby ${{ matrix.ruby }} and ${{ matrix.gemfile }}
|
13
|
+
runs-on: "ubuntu-latest"
|
14
|
+
strategy:
|
15
|
+
fail-fast: false
|
16
|
+
matrix:
|
17
|
+
ruby: ["2.7", "3.0"]
|
18
|
+
gemfile:
|
19
|
+
- Gemfile
|
20
|
+
- gemfiles/7_0.gemfile
|
21
|
+
- gemfiles/6_1.gemfile
|
22
|
+
- gemfiles/6_0.gemfile
|
23
|
+
|
24
|
+
services:
|
25
|
+
postgres:
|
26
|
+
image: postgres:11.5
|
27
|
+
ports: ["5432:5432"]
|
28
|
+
options:
|
29
|
+
--health-cmd pg_isready --health-interval 10s --health-timeout 5s
|
30
|
+
--health-retries 5
|
31
|
+
|
32
|
+
steps:
|
33
|
+
- uses: actions/checkout@v2.4.0
|
34
|
+
|
35
|
+
- uses: actions/cache@v2
|
36
|
+
with:
|
37
|
+
path: vendor/bundle
|
38
|
+
key: >
|
39
|
+
${{ runner.os }}-${{ matrix.ruby }}-gems-${{
|
40
|
+
hashFiles(matrix.gemfile) }}
|
41
|
+
restore-keys: >
|
42
|
+
${{ runner.os }}-${{ matrix.ruby }}-gems-${{
|
43
|
+
hashFiles(matrix.gemfile) }}
|
44
|
+
|
45
|
+
- name: Set up Ruby
|
46
|
+
uses: ruby/setup-ruby@v1
|
47
|
+
with:
|
48
|
+
ruby-version: ${{ matrix.ruby }}
|
49
|
+
|
50
|
+
- name: Install PostgreSQL client
|
51
|
+
env:
|
52
|
+
PGHOST: localhost
|
53
|
+
PGUSER: postgres
|
54
|
+
run: |
|
55
|
+
sudo apt-get -yqq install libpq-dev
|
56
|
+
psql -U postgres -c "create database test"
|
57
|
+
|
58
|
+
- name: Install gem dependencies
|
59
|
+
env:
|
60
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
61
|
+
run: |
|
62
|
+
gem install bundler
|
63
|
+
bundle config path vendor/bundle
|
64
|
+
bundle update --jobs 4 --retry 3
|
65
|
+
|
66
|
+
- name: Run Tests
|
67
|
+
env:
|
68
|
+
PGHOST: localhost
|
69
|
+
PGUSER: postgres
|
70
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
71
|
+
run: |
|
72
|
+
bundle exec rake
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
---
|
2
|
+
inherit_gem:
|
3
|
+
rubocop-fnando: .rubocop.yml
|
4
|
+
|
5
|
+
AllCops:
|
6
|
+
TargetRubyVersion: 2.7
|
7
|
+
|
8
|
+
Naming/FileName:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Metrics/MethodLength:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
Metrics/ClassLength:
|
15
|
+
Exclude:
|
16
|
+
- test/**/*
|
17
|
+
|
18
|
+
Metrics/AbcSize:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Metrics/CyclomaticComplexity:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Metrics/PerceivedComplexity:
|
25
|
+
Enabled: false
|
data/.travis.yml
CHANGED
@@ -1,31 +1,32 @@
|
|
1
|
+
---
|
1
2
|
language: ruby
|
2
3
|
sudo: false
|
3
4
|
cache: bundler
|
4
5
|
before_install:
|
5
|
-
- gem install bundler
|
6
|
+
- gem install bundler
|
6
7
|
before_script:
|
7
|
-
- createdb test
|
8
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
9
|
-
- chmod +x ./cc-test-reporter
|
10
|
-
- ./cc-test-reporter before-build
|
8
|
+
- createdb test
|
9
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
10
|
+
- chmod +x ./cc-test-reporter
|
11
|
+
- ./cc-test-reporter before-build
|
11
12
|
after_script:
|
12
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
13
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
13
14
|
gemfile:
|
14
|
-
-
|
15
|
-
- gemfiles/activerecord_5_2.gemfile
|
16
|
-
- gemfiles/activerecord_5_1.gemfile
|
17
|
-
- gemfiles/activerecord_5_0.gemfile
|
15
|
+
- gemfiles/activerecord_6_0.gemfile
|
16
|
+
- gemfiles/activerecord_5_2.gemfile
|
17
|
+
- gemfiles/activerecord_5_1.gemfile
|
18
|
+
- gemfiles/activerecord_5_0.gemfile
|
18
19
|
addons:
|
19
|
-
postgresql:
|
20
|
+
postgresql: "10"
|
20
21
|
apt:
|
21
22
|
packages:
|
22
|
-
|
23
|
-
|
23
|
+
- postgresql-10
|
24
|
+
- postgresql-client-10
|
24
25
|
rvm:
|
25
|
-
- 2.5
|
26
|
+
- 2.6.5
|
27
|
+
- 2.5.7
|
26
28
|
notifications:
|
27
29
|
email: false
|
28
30
|
env:
|
29
31
|
global:
|
30
|
-
|
31
|
-
- secure: tJIhjywY5r1oi4ShGqAoy+Jg17u+K9KfZtvC2lGmlhd9v5sU+MmuFZqoJAM1sGSY6UTsMfKs6vifyEGnVtawv1VK1RnNzQNWCUrm/hqdNDvayIh4m4oDt27EWj6cgh5roc6Y8knmkup+rXGQiVUmUgMjjF0NhLYZPgp6UPC5NhozEE8Y31Cv0M2UUnz460XyBQAvCPq7z7/rrTVJN84ioV755U/UiingIn16RG5A13TN3xTJbIhmxFcJpn8edX7H3DUSsDafKn4e+tiTXg0WnOFTTR9P1D3kah86AT7kvf4s/6ETRnZm+Rnv30ZNIQaTFlJv6zHTCzmLsRJ4CTUFHgjIrsDbOFeZmpgxSJg5sYFPgNsNh+BovWZuWoKgSkZXh0NaFhiGhQivd4/HwX45W4BybS1/Bm79mG25k14xbQUlMXZA5gRFA3v+ih4lxDNp5YqXJJhrs4ApSOuUsPJrp/JCKZkTzKXvOgNm8EvZtZrnkEeSItbq8M20m2N38bCq/uNU+h0gCknLsoheRGB/JvOI+uBehwWAITwcaUlZPHu4/n+ASKufaqeWfZRnSEA04fIkpT4H03O8zWZwvJ+gnuEbh0t/eLOTLOJOINuT9qwgduobWyBqQC+RkkHBFEV6fFH2yld8RwCXZNu3g1q40OBN4dvvMp/8VZEVxSB0I74=
|
32
|
+
secure: tJIhjywY5r1oi4ShGqAoy+Jg17u+K9KfZtvC2lGmlhd9v5sU+MmuFZqoJAM1sGSY6UTsMfKs6vifyEGnVtawv1VK1RnNzQNWCUrm/hqdNDvayIh4m4oDt27EWj6cgh5roc6Y8knmkup+rXGQiVUmUgMjjF0NhLYZPgp6UPC5NhozEE8Y31Cv0M2UUnz460XyBQAvCPq7z7/rrTVJN84ioV755U/UiingIn16RG5A13TN3xTJbIhmxFcJpn8edX7H3DUSsDafKn4e+tiTXg0WnOFTTR9P1D3kah86AT7kvf4s/6ETRnZm+Rnv30ZNIQaTFlJv6zHTCzmLsRJ4CTUFHgjIrsDbOFeZmpgxSJg5sYFPgNsNh+BovWZuWoKgSkZXh0NaFhiGhQivd4/HwX45W4BybS1/Bm79mG25k14xbQUlMXZA5gRFA3v+ih4lxDNp5YqXJJhrs4ApSOuUsPJrp/JCKZkTzKXvOgNm8EvZtZrnkEeSItbq8M20m2N38bCq/uNU+h0gCknLsoheRGB/JvOI+uBehwWAITwcaUlZPHu4/n+ASKufaqeWfZRnSEA04fIkpT4H03O8zWZwvJ+gnuEbh0t/eLOTLOJOINuT9qwgduobWyBqQC+RkkHBFEV6fFH2yld8RwCXZNu3g1q40OBN4dvvMp/8VZEVxSB0I74=
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,32 @@
|
|
1
|
-
#
|
1
|
+
# Changelog
|
2
2
|
|
3
|
-
|
3
|
+
<!--
|
4
|
+
Prefix your message with one of the following:
|
4
5
|
|
5
|
-
-
|
6
|
+
- [Added] for new features.
|
7
|
+
- [Changed] for changes in existing functionality.
|
8
|
+
- [Deprecated] for soon-to-be removed features.
|
9
|
+
- [Removed] for now removed features.
|
10
|
+
- [Fixed] for any bug fixes.
|
11
|
+
- [Security] in case of vulnerabilities.
|
12
|
+
-->
|
13
|
+
|
14
|
+
## v0.2.1 - 2021-12-21
|
15
|
+
|
16
|
+
- [Changed] Dump schema names that aren't on the default search path.
|
17
|
+
|
18
|
+
## v0.2.0 - 2021-09-16
|
19
|
+
|
20
|
+
- [Changed] Only dump sequences created by ar_sequence (using Postgres COMMENT).
|
21
|
+
|
22
|
+
## v0.1.2 - 2020-09-23
|
23
|
+
|
24
|
+
- [Changed] Output sequence names in predictable order.
|
25
|
+
|
26
|
+
## v0.1.1 - 2019-11-26
|
27
|
+
|
28
|
+
- No significant changes.
|
29
|
+
|
30
|
+
## v0.1.0 - 2018-10-02
|
31
|
+
|
32
|
+
- Initial release.
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -1,13 +1,74 @@
|
|
1
|
-
# Contributor Code of Conduct
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
2
|
|
3
|
-
|
3
|
+
## Our Pledge
|
4
4
|
|
5
|
-
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
6
11
|
|
7
|
-
|
12
|
+
## Our Standards
|
8
13
|
|
9
|
-
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
10
16
|
|
11
|
-
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
12
22
|
|
13
|
-
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at me@fnando.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
# Contributing to ar-sequence
|
2
|
+
|
3
|
+
👍🎉 First off, thanks for taking the time to contribute! 🎉👍
|
4
|
+
|
5
|
+
The following is a set of guidelines for contributing to this project. These are
|
6
|
+
mostly guidelines, not rules. Use your best judgment, and feel free to propose
|
7
|
+
changes to this document in a pull request.
|
8
|
+
|
9
|
+
## Code of Conduct
|
10
|
+
|
11
|
+
Everyone interacting in this project's codebases, issue trackers, chat rooms and
|
12
|
+
mailing lists is expected to follow the [code of conduct](https://github.com/fnando/ar-sequence/blob/main/CODE_OF_CONDUCT.md).
|
13
|
+
|
14
|
+
## Reporting bugs
|
15
|
+
|
16
|
+
This section guides you through submitting a bug report. Following these
|
17
|
+
guidelines helps maintainers and the community understand your report, reproduce
|
18
|
+
the behavior, and find related reports.
|
19
|
+
|
20
|
+
- Before creating bug reports, please check the open issues; somebody may
|
21
|
+
already have submitted something similar, and you may not need to create a new
|
22
|
+
one.
|
23
|
+
- When you are creating a bug report, please include as many details as
|
24
|
+
possible, with an example reproducing the issue.
|
25
|
+
|
26
|
+
## Contributing with code
|
27
|
+
|
28
|
+
Before making any radicals changes, please make sure you discuss your intention
|
29
|
+
by [opening an issue on Github](https://github.com/fnando/ar-sequence/issues).
|
30
|
+
|
31
|
+
When you're ready to make your pull request, follow checklist below to make sure
|
32
|
+
your contribution is according to how this project works.
|
33
|
+
|
34
|
+
1. [Fork](https://help.github.com/forking/) ar-sequence
|
35
|
+
2. Create a topic branch - `git checkout -b my_branch`
|
36
|
+
3. Make your changes using [descriptive commit messages](#commit-messages)
|
37
|
+
4. Update CHANGELOG.md describing your changes by adding an entry to the
|
38
|
+
"Unreleased" section. If this section is not available, create one right
|
39
|
+
before the last version.
|
40
|
+
5. Push to your branch - `git push origin my_branch`
|
41
|
+
6. [Create a pull request](https://docs.github.com/articles/creating-a-pull-request)
|
42
|
+
7. That's it!
|
43
|
+
|
44
|
+
## Styleguides
|
45
|
+
|
46
|
+
### Commit messages
|
47
|
+
|
48
|
+
- Use the present tense ("Add feature" not "Added feature")
|
49
|
+
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
|
50
|
+
- Limit the first line to 72 characters or less
|
51
|
+
- Reference issues and pull requests liberally after the first line
|
52
|
+
|
53
|
+
### Changelog
|
54
|
+
|
55
|
+
- Add a message describing your changes to the "Unreleased" section. The
|
56
|
+
changelog message should follow the same style as the commit message.
|
57
|
+
- Prefix your message with one of the following:
|
58
|
+
- `[Added]` for new features.
|
59
|
+
- `[Changed]` for changes in existing functionality.
|
60
|
+
- `[Deprecated]` for soon-to-be removed features.
|
61
|
+
- `[Removed]` for now removed features.
|
62
|
+
- `[Fixed]` for any bug fixes.
|
63
|
+
- `[Security]` in case of vulnerabilities.
|
64
|
+
|
65
|
+
### Ruby code
|
66
|
+
|
67
|
+
- This project uses [Rubocop](https://rubocop.org) to enforce code style. Before
|
68
|
+
submitting your changes, make sure your tests are passing and code conforms to
|
69
|
+
the expected style by running `rake`.
|
70
|
+
- Do not change the library version. This will be done by the maintainer
|
71
|
+
whenever a new version is about to be released.
|
72
|
+
|
73
|
+
### JavaScript code
|
74
|
+
|
75
|
+
- This project uses [ESLint](https://eslint.org) to enforce code style. Before
|
76
|
+
submitting your changes, make sure your tests are passing and code conforms to
|
77
|
+
the expected style by running `yarn test:ci`.
|
78
|
+
- Do not change the library version. This will be done by the maintainer
|
79
|
+
whenever a new version is about to be released.
|
data/Gemfile
CHANGED
data/LICENSE.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Nando Vieira
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,42 +1,37 @@
|
|
1
|
-
#
|
1
|
+
# ar-sequence
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![Tests](https://github.com/fnando/ar-sequence/workflows/Tests/badge.svg)](https://github.com/fnando/ar-sequence)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/fnando/ar-sequence/badges/gpa.svg)](https://codeclimate.com/github/fnando/ar-sequence)
|
5
|
-
[![Test Coverage](https://codeclimate.com/github/fnando/ar-sequence/badges/coverage.svg)](https://codeclimate.com/github/fnando/ar-sequence/coverage)
|
6
5
|
[![Gem](https://img.shields.io/gem/v/ar-sequence.svg)](https://rubygems.org/gems/ar-sequence)
|
7
6
|
[![Gem](https://img.shields.io/gem/dt/ar-sequence.svg)](https://rubygems.org/gems/ar-sequence)
|
8
7
|
|
9
|
-
Add support for PostgreSQL's SEQUENCE on ActiveRecord migrations.
|
8
|
+
Add support for PostgreSQL's `SEQUENCE` on ActiveRecord migrations.
|
10
9
|
|
11
10
|
## Installation
|
12
11
|
|
13
|
-
|
12
|
+
```bash
|
13
|
+
gem install ar-sequence
|
14
|
+
```
|
15
|
+
|
16
|
+
Or add the following line to your project's Gemfile:
|
14
17
|
|
15
18
|
```ruby
|
16
19
|
gem "ar-sequence"
|
17
20
|
```
|
18
21
|
|
19
|
-
And then execute:
|
20
|
-
|
21
|
-
$ bundle
|
22
|
-
|
23
|
-
Or install it yourself as:
|
24
|
-
|
25
|
-
$ gem install ar-sequence
|
26
|
-
|
27
22
|
## Usage
|
28
23
|
|
29
24
|
To create a `SEQUENCE`, just use the method `create_sequence`.
|
30
25
|
|
31
26
|
```ruby
|
32
27
|
class CreateUsers < ActiveRecord::Migration[5.2]
|
33
|
-
|
34
|
-
|
35
|
-
|
28
|
+
def up
|
29
|
+
create_sequence :position
|
30
|
+
end
|
36
31
|
|
37
|
-
|
38
|
-
|
39
|
-
|
32
|
+
def down
|
33
|
+
drop_sequence :position
|
34
|
+
end
|
40
35
|
end
|
41
36
|
```
|
42
37
|
|
@@ -47,7 +42,8 @@ create_sequence :position, increment: 2
|
|
47
42
|
create_sequence :position, start: 100
|
48
43
|
```
|
49
44
|
|
50
|
-
To define a column that has a sequence as its default value, use something like
|
45
|
+
To define a column that has a sequence as its default value, use something like
|
46
|
+
the following:
|
51
47
|
|
52
48
|
```ruby
|
53
49
|
class CreateThings < ActiveRecord::Migration[5.2]
|
@@ -72,23 +68,37 @@ end
|
|
72
68
|
This gem also adds a few helpers to interact with `SEQUENCE`s.
|
73
69
|
|
74
70
|
```ruby
|
75
|
-
|
76
|
-
ActiveRecord::Base.
|
77
|
-
|
71
|
+
# Advance sequence and return new value
|
72
|
+
ActiveRecord::Base.nextval("position")
|
73
|
+
|
74
|
+
# Return value most recently obtained with nextval for specified sequence.
|
75
|
+
ActiveRecord::Base.currval("position")
|
76
|
+
|
77
|
+
# Set sequence's current value
|
78
|
+
ActiveRecord::Base.setval("position", 1234)
|
78
79
|
```
|
79
80
|
|
80
|
-
##
|
81
|
+
## Maintainer
|
81
82
|
|
82
|
-
|
83
|
+
- [Nando Vieira](https://github.com/fnando)
|
83
84
|
|
84
|
-
|
85
|
+
## Contributors
|
85
86
|
|
86
|
-
|
87
|
+
- https://github.com/fnando/ar-sequence/contributors
|
87
88
|
|
88
|
-
|
89
|
+
## Contributing
|
89
90
|
|
91
|
+
For more details about how to contribute, please read
|
92
|
+
https://github.com/fnando/ar-sequence/blob/main/CONTRIBUTING.md.
|
90
93
|
|
91
94
|
## License
|
92
95
|
|
93
|
-
The gem is available as open source under the terms of the
|
96
|
+
The gem is available as open source under the terms of the
|
97
|
+
[MIT License](https://opensource.org/licenses/MIT). A copy of the license can be
|
98
|
+
found at https://github.com/fnando/ar-sequence/blob/main/LICENSE.md.
|
99
|
+
|
100
|
+
## Code of Conduct
|
94
101
|
|
102
|
+
Everyone interacting in the ar-sequence project's codebases, issue trackers,
|
103
|
+
chat rooms and mailing lists is expected to follow the
|
104
|
+
[code of conduct](https://github.com/fnando/ar-sequence/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "bundler/gem_tasks"
|
2
4
|
require "rake/testtask"
|
5
|
+
require "rubocop/rake_task"
|
3
6
|
|
4
7
|
Rake::TestTask.new(:test) do |t|
|
5
8
|
t.libs << "test"
|
6
9
|
t.libs << "lib"
|
7
10
|
t.test_files = FileList["test/**/*_test.rb"]
|
8
|
-
t.verbose = false
|
9
|
-
t.warning = false
|
10
11
|
end
|
11
12
|
|
12
|
-
|
13
|
+
RuboCop::RakeTask.new
|
14
|
+
|
15
|
+
task default: %i[test rubocop]
|