2013-03-21 32 views
0

我重命名錶軌重命名錶id_seq

rename_table :posts, :messages 

但軌道產生posts_id_seq和posts.id修飾符:

db=# \d+ posts 
               Table "public.posts" 
     Column   |   Type    |       Modifiers       | Storage | Description 
id     | integer      | not null default nextval('posts_id_seq'::regclass) | plain | 

Indexes: 
    "posts_pkey" PRIMARY KEY, btree (id) 

如何糾正重命名錶?

紅寶石1.8.7

軌2.3

+0

我編輯了問題 – Nar 2013-03-21 06:03:02

回答

1

它看起來像一個改變來解決這種行爲被合併到Rails幾個月前(見問題#6864),但修復可能是不存在的Rails 2.3系列。您將需要使用Rails 4(仍在開發/測試版)來修復。

+0

可能有可執行手動更正的命令嗎? – Nar 2013-03-21 06:05:45

+0

請參閱[diffs](https://github.com/rails/rails/pull/6874/files),但它基本歸結爲'ALTER TABLE <舊seq名稱>重命名爲<新seq名稱> ' – 2013-03-21 06:06:43

+0

當我運行ALTER TABLE發佈RENAME TO消息時,postgressql只重命名錶和索引/外鍵未修改。 – Nar 2013-03-21 06:14:16