如何编写迁移文件以添加字段类型'ltree'(PostgreSQL)
Schema::create('table', function (Blueprint $table) { .... $table->ltree('path'); }不起作用。
谢谢!
How to write the migration file to add the field type 'ltree' (PostgreSQL)
Schema::create('table', function (Blueprint $table) { .... $table->ltree('path'); }Does not work.
Thanks!
最满意答案
查看可用功能的手册: https : //laravel.com/docs/5.1/migrations#creating-columns
Laravel的目标是兼容性,因此除非在所有受支持的数据库中都有相同的结构,否则它们本身不太可能支持它。
您可以使用DB::statement('CREATE TABLE ...') statement手动运行SQL语句DB::statement('CREATE TABLE ...')
请记住,您的应用程序将被锁定到postgres,这可能并不理想。
Look to the manual of the functions available: https://laravel.com/docs/5.1/migrations#creating-columns
Laravel's goal is compatibility, so unless there is equivalent structures in all supported databases, they aren't likely to support it natively.
You can run SQL statements manually using DB::statement('CREATE TABLE ...')
Just keep in mind that your application will be locked to postgres which may not be ideal.
更多推荐
发布评论