only ignore json files in data dir, tracking seed and wipe scripts
This commit is contained in:
parent
7e674af40a
commit
7ee4bac3fa
3 changed files with 29 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
vendor/
|
vendor/
|
||||||
node_modules/
|
node_modules/
|
||||||
data/
|
data/*.json
|
||||||
.direnv/
|
.direnv/
|
||||||
17
data/seedDb.php
Normal file
17
data/seedDb.php
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$texts = [
|
||||||
|
[
|
||||||
|
'id' => 0,
|
||||||
|
'name' => 'test text'
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$fileDataMap = [
|
||||||
|
'texts.json' => $texts,
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($fileDataMap as $file => $data) {
|
||||||
|
$path = __DIR__."/$file";
|
||||||
|
file_put_contents($path, json_encode($data, JSON_PRETTY_PRINT));
|
||||||
|
}
|
||||||
11
data/wipeDb.php
Normal file
11
data/wipeDb.php
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$files = [
|
||||||
|
'texts.json',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($files as $file) {
|
||||||
|
echo __DIR__."/$file";
|
||||||
|
$path = __DIR__."/$file";
|
||||||
|
file_put_contents($path, json_encode([], JSON_PRETTY_PRINT));
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue