Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jqr/postgres_sequence_support
Support for manipulating PostgreSQL sequences from ActiveRecord.
https://github.com/jqr/postgres_sequence_support
postgresql rails ruby
Last synced: 11 days ago
JSON representation
Support for manipulating PostgreSQL sequences from ActiveRecord.
- Host: GitHub
- URL: https://github.com/jqr/postgres_sequence_support
- Owner: jqr
- License: mit
- Created: 2008-05-04T00:51:32.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2017-09-11T16:32:54.000Z (over 7 years ago)
- Last Synced: 2024-03-15T00:04:30.575Z (10 months ago)
- Topics: postgresql, rails, ruby
- Language: Ruby
- Homepage:
- Size: 7.81 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rdoc
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
= Postgres Sequence Support
Easy manipulation of PostgreSQL sequences from ActiveRecord.
== Examples
User.next_id # => 1
User.current_id # => 1c = ActiveRecord::Base.connection
c.set_sequence('users_id_seq', 1000)
c.next_in_sequence('users_id_seq') # => 1001
# Note : create sequence don't do anything if sequence already exists
c.create_sequence('my_own_seq')
c.next_in_sequence('my_own_seq') # => 1
# You can specify sequence start
c.create_sequence('my_own_seq', 1001)
c.next_in_sequence('my_own_seq') # => 1001
# Check if sequence exists
c.sequence_exists?('my_own_seq') # => true
c.sequence_exists?('my_other_seq') # => false
# Drop sequence if it exists
c.drop_sequence('my_own_seq')
== InstallAs a Rails plugin.
./script/plugin install git://github.com/jqr/postgres_sequence_support.git
Prefer gems? Add this to your environment.rb and run the following command.
config.gem 'postgres_sequence_support'
$ rake gems:install
== Docs
http://rdoc.info/projects/jqr/postgres_sequence_support
Homepage:: http://github.com/jqr/postgres_sequence_support
License:: Copyright (c) 2008 Elijah Miller , released under the MIT license.