silverstripe/sqlite3

本包的最新版本(3.0.0)没有提供许可证信息。

为SilverStripe添加SQLite3支持

安装数: 461,088

依赖项: 17

建议者: 0

安全: 0

星标: 8

关注者: 9

分支: 22

公开问题: 6

类型:silverstripe-vendormodule

3.0.0 2023-04-24 02:02 UTC

README

CI

维护者联系方式

Andreas Piening(昵称:apiening)<andreas (at) silverstripe (dot) com>

安装

composer require silverstripe/sqlite3

配置

可以使用安装程序自动安装SQLite,或者在_config.php文件中添加以下内容(如果您使用_ss_environment.php,请在"require_once("conf/ConfigureFromEnv.php");"之后添加):

$databaseConfig['type'] = 'SQLite3Database';
$databaseConfig['path'] = "/path/to/my/database/file";

请确保Web服务器有足够的权限写入该文件夹,并且要防止外部访问。

示例mysite/_config.php

<?php
global $project;
$project = 'mysite';

global $database;
$database = 'SS_mysite';

require_once("conf/ConfigureFromEnv.php");

global $databaseConfig;
$databaseConfig = array(
	"type" => 'SQLite3Database',
	"server" => 'none',
	"username" => 'none',
	"password" => 'none',
	"database" => $database,
	"path" => "/path/to/my/database/file",
);

再次提醒:请确保Web服务器有权限读取和写入上述路径(/path/to/my/database/,'file'是sqlite数据库文件的名称)

URL参数

如果您尝试将包含NULLs的字段的字段约束更改为NOT NULL,则dev/build会失败,因为这可能会破坏现有记录。要执行此操作,请在运行dev/build时添加URL参数'avoidConflict',它将临时将冲突子句添加到字段规范中。例如:http://www.my-project.com/?avoidConflict=1

公开问题

  • SQLite3应该与所有模块一起工作,但由于它们直接将自定义SQL语句传递给DB类,因此某些模块可能无法一起工作;(
  • 还没有真正的全文搜索,内置搜索引擎也不是按相关性排序,请查看fts3