Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/24.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
Ruby on rails 运行rake迁移时遇到postgres错误_Ruby On Rails_Ruby_Database_Postgresql_Rake - Fatal编程技术网

Ruby on rails 运行rake迁移时遇到postgres错误

Ruby on rails 运行rake迁移时遇到postgres错误,ruby-on-rails,ruby,database,postgresql,rake,Ruby On Rails,Ruby,Database,Postgresql,Rake,我在运行以postgres为后端的rails应用程序时遇到以下uuid错误。有人能帮我解决哪些依赖关系是必需的吗 [root@localhost webapp]# rake db:migrate (in /root/mysite/webapp) == CreateContributors: migrating ============================================= -- create_table(:contributors, {:i

我在运行以postgres为后端的rails应用程序时遇到以下uuid错误。有人能帮我解决哪些依赖关系是必需的吗

 [root@localhost webapp]# rake db:migrate
    (in /root/mysite/webapp)
    ==  CreateContributors: migrating =============================================
    -- create_table(:contributors, {:id=>false})
       -> 0.0121s
    -- execute("alter table contributors add primary key (id)")
    NOTICE:  ALTER TABLE / ADD PRIMARY KEY will create implicit index "contributors_pkey" for table "contributors"
       -> 0.0797s
    -- execute("alter table contributors alter column id set default uuid_generate_v1()::varchar")
    rake aborted!
    An error has occurred, this and all later migrations canceled:

    PGError: ERROR:  function uuid_generate_v1() does not exist
    HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
    : alter table contributors alter column id set default uuid_generate_v1()::varchar
uuid\u generate\u v1()
函数是的一部分,您必须先将其安装到PostgreSQL中,然后才能使用它。在PostgreSQL
contrib
目录中应该有一个名为
uuid ossp.sql
的文件。您可以通过以下方式安装软件包:

$ psql -d your_database < /the/path/to/uuid-ossp.sql
$psql-d您的_数据库

您可能希望以数据库超级用户的身份运行该文件。

感谢它现在起作用了,实际上路径是一个问题,它在pgsql/contrib中,我正在postgres Folder中查找该文件在ubuntu上的目录似乎是:/usr/share/postgresql/[postgres version]/extension