2017 © Pedro Peláez
 

library pgsql-sequences

Dbmover plugin to handle PostgreSQL sequences

image

dbmover/pgsql-sequences

Dbmover plugin to handle PostgreSQL sequences

  • Monday, April 17, 2017
  • by monomelodies
  • Repository
  • 1 Watchers
  • 0 Stars
  • 80 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 14 % Grown

The README.md

Dbmover\PgsqlSequences

DbMover plugin to handle PostgreSQL sequences, (*1)

PostgreSQL uses "sequences" or "serials" to implement auto-incrementing columns. This plugin adds support for them in your schema's, since they are an extension to SQL., (*2)

Installation

$ composer require dbmover/pgsql-sequences
This package is part of the `dbmover/pgsql` meta-package.

Usage

For general DbMover usage, see dbmover/core., (*3)

PostgreSQL allows a shorthand data type SERIAL for serial columns. This is actually an alias to INTEGER that also implicitly creates a sequence if it does not exist yet (with the name TABLE_COLUMN_seq). Since SERIAL isn't a "real" data type, DbMover does not support it. You should explicitly create sequences, use actual column types for them (INTEGER or BIGINT) and explicitly use PostgreSQL's NEXTVAL function to define the column's default value., (*4)

As an example:, (*5)

CREATE SEQUENCE foo_id_seq;

CREATE TABLE foo (
    INTEGER id NOT NULL PRIMARY KEY DEFAULT NEXTVAL('foo_id_seq'::regclass)
);

The plugin checks if the requested sequence doesn't already exist. If it does, it is skipped. So, no need to add IF NOT EXISTS clauses as introduced in PostgreSQL 9.5. You're allowed to add them for peace of mind, though., (*6)

Contributing

See dbmover/core., (*7)

The Versions

17/04 2017

dev-master

9999999-dev

Dbmover plugin to handle PostgreSQL sequences

  Sources   Download

MIT

The Requires

 

by Marijn Ophorst

17/04 2017

0.2.2

0.2.2.0

Dbmover plugin to handle PostgreSQL sequences

  Sources   Download

MIT

The Requires

 

by Marijn Ophorst

17/04 2017

dev-develop

dev-develop

Dbmover plugin to handle PostgreSQL sequences

  Sources   Download

MIT

The Requires

 

by Marijn Ophorst

17/04 2017

0.2.1

0.2.1.0

Dbmover plugin to handle PostgreSQL sequences

  Sources   Download

MIT

The Requires

 

by Marijn Ophorst

16/04 2017

0.2.0

0.2.0.0

Dbmover plugin to handle PostgreSQL sequences

  Sources   Download

MIT

The Requires

 

by Marijn Ophorst

15/04 2017

0.1.1

0.1.1.0

Dbmover plugin to handle PostgreSQL sequences

  Sources   Download

MIT

The Requires

 

by Marijn Ophorst

15/04 2017

0.1.0

0.1.0.0

Dbmover plugin to handle PostgreSQL sequences

  Sources   Download

MIT

The Requires

 

by Marijn Ophorst