Skip to content

Commit

Permalink
Add crdb v23 (#29)
Browse files Browse the repository at this point in the history
* Add crdb v23

* deprecate old crdb versions

* update composer keywords

* fix database script for Crdb v23
  • Loading branch information
peterfox authored Jan 13, 2024
1 parent 724d2cf commit f3383bb
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
os: [ ubuntu-latest ]
php: [ 8.0, 8.1, 8.2 ]
laravel: [ 10.*, 9.*, 8.* ]
cockroachdb: [ v21.2.15, v22.1.12 ]
cockroachdb: [ v22.2.17, v23.1.13 ]
dependencies: [ stable, lowest ]
include:
- laravel: 10.*
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"keywords": [
"ylsideas",
"laravel",
"cockroachdb-laravel"
"cockroachdb-laravel",
"cockroachdb"
],
"homepage": "https://github.com/ylsideas/cockroachdb-laravel",
"license": "MIT",
Expand Down
27 changes: 17 additions & 10 deletions database.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,24 @@
CREATE DATABASE forge;
CREATE USER forge;
GRANT ALL PRIVILEGES ON DATABASE forge TO forge;
SET CLUSTER SETTING kv.raft_log.disable_synchronization_unsafe = true;
SET CLUSTER SETTING kv.range_merge.queue_interval = '50ms';
SET CLUSTER SETTING jobs.registry.interval.gc = '30s';
SET CLUSTER SETTING jobs.registry.interval.cancel = '180s';
SET CLUSTER SETTING jobs.retention_time = '15s';
SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
SET CLUSTER SETTING kv.range_split.by_load_merge_delay = '5s';
ALTER RANGE default CONFIGURE ZONE USING "gc.ttlseconds" = 5;
ALTER DATABASE system CONFIGURE ZONE USING "gc.ttlseconds" = 5;
heredoc);

$statements = [
'SET CLUSTER SETTING kv.raft_log.disable_synchronization_unsafe = true;',
'SET CLUSTER SETTING kv.range_merge.queue_interval = \'50ms\';',
'SET CLUSTER SETTING jobs.registry.interval.gc = \'30s\';',
'SET CLUSTER SETTING jobs.registry.interval.cancel = \'180s\';',
'SET CLUSTER SETTING jobs.retention_time = \'15s\';',
'SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;',
'SET CLUSTER SETTING kv.range_split.by_load_merge_delay = \'5s\';',
'ALTER RANGE default CONFIGURE ZONE USING "gc.ttlseconds" = 5;',
'ALTER DATABASE system CONFIGURE ZONE USING "gc.ttlseconds" = 5;',
];

foreach ($statements as $statement) {
$pdo->exec($statement);
}

} catch (PDOException $exception) {
exit('Failed to creating database: ' . $exception->getMessage() . PHP_EOL);
}
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3'
services:
crdb:
image: "cockroachdb/cockroach:${VERSION:-v21.2.15}"
image: "cockroachdb/cockroach:${VERSION:-v23.1.13}"
ports:
- "26257:26257"
- "8080:8080"
Expand Down

0 comments on commit f3383bb

Please sign in to comment.