Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 设置/更改Rails id自动增量值_Mysql_Ruby On Rails_Postgresql_Rails Postgresql - Fatal编程技术网

Mysql 设置/更改Rails id自动增量值

Mysql 设置/更改Rails id自动增量值,mysql,ruby-on-rails,postgresql,rails-postgresql,Mysql,Ruby On Rails,Postgresql,Rails Postgresql,我有没有办法在Rails中设置id的增量值?不是+1,而是+10(或我指定的其他函数) 在MySQL中有一个选项@@auto\u increment\u increment。有没有办法通过ActiveRecord在Rails中进行设置?我正在与两位Postgre合作。查看Rails 3.x迁移指南: 有一个例子,他们硬编码一些sql class SomeMigration < ActiveRecord::Migration def up execute <<

我有没有办法在Rails中设置id的增量值?不是+1,而是+10(或我指定的其他函数)


在MySQL中有一个选项@@auto\u increment\u increment。有没有办法通过ActiveRecord在Rails中进行设置?我正在与两位Postgre合作。

查看Rails 3.x迁移指南:

有一个例子,他们硬编码一些sql

class SomeMigration < ActiveRecord::Migration

    def up
      execute <<-SQL
            ALTER TABLE xxx
      SQL
    end

end 
classsomemigration执行检查Rails 3.x迁移指南:

有一个例子,他们硬编码一些sql

class SomeMigration < ActiveRecord::Migration

    def up
      execute <<-SQL
            ALTER TABLE xxx
      SQL
    end

end 
classsomemigration