LoginSignup
2
2

More than 5 years have passed since last update.

シーケンステーブルの作成と更新

Last updated at Posted at 2013-07-09

EC-CUBE2.11系以降は、auto_increment しない仕様なので、インストール時にちょっと困る。
install.php を素直に使わず、シェルで動かす場合、シーケンステーブルを作る必要があるので、メモ。

dtb_plugin
plugin_id がSEQUENCE にする。

PostgreSQL の場合
CREATE SEQUENCE dtb_plugin_plugin_id_seq;
SELECT SETVAL('dtb_plugin' , (SELECT MAX(plugin_id) + 1 FROM dtb_plugin) , false);
MySQL の場合
CREATE TABLE dtb_plugin_plugin_id_seq (
    sequence int(11) NOT NULL AUTO_INCREMENT,
    PRIMARY KEY (sequence)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES dtb_plugin_plugin_id_seq WRITE;
INSERT INTO dtb_plugin_plugin_id_seq VALUES (1);
UNLOCK TABLES;

他のDBも考えての汎用性をもたせる措置だと思うんだけど、う~ん。
プラグインとか作る時に気をつけなければ。

2
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2