If you define a migration below, Oracle enhanced adapter generates two separate sql statements - create table and create sequence.
create_table :posts do |t| end
SQL> CREATE TABLE "POSTS" ("ID" NUMBER(38) NOT NULL PRIMARY KEY) 2 ; Table created. SQL> CREATE SEQUENCE "POSTS_SEQ" START WITH 10000 2 ; Sequence created.
To consider identity data support, We will need to consider how to migrate existing sequence based primary key to identity based one.
Fortunately, Oracle 12c default clause can specify
sequence.nextval like below.
SQL> alter table posts modify (id default posts_seq.nextval); Table altered.
SQL> insert into posts(id) values (default); 1 row created. SQL> select * from posts; ID ---------- 10000 SQL>
It may or may not be identical with
identitity data type but it would definitely make us easy to migrate from sequence based primary key to identity based primary key.