Compare commits

...

2 commits

Author SHA1 Message Date
fef
56f2b1e1cc
add webstorm project config files 2022-12-04 21:58:30 +01:00
fef
44a3aaa825
create small helper for db migrations
I don't really know shit about web development in
rust but this seems like a helpful little tool as
i'm not planning on using a fully-fledged ORM
framework.
2022-12-04 21:57:33 +01:00
9 changed files with 64 additions and 1 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
/node_modules
/public/js
/target
/.env

5
.idea/.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/

View file

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

8
.idea/modules.xml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/nyanoblog.iml" filepath="$PROJECT_DIR$/.idea/nyanoblog.iml" />
</modules>
</component>
</project>

14
.idea/nyanoblog.iml Normal file
View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View file

@ -0,0 +1,7 @@
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS __nyano_migrations (id VARCHAR PRIMARY KEY NOT NULL);
INSERT INTO __nyano_migrations (id) VALUES ('00000000000000_init');
END TRANSACTION;

View file

@ -13,7 +13,7 @@
},
"repository": {
"type": "git",
"url": "https://git.bsd.gay/nyanoblog/nyanoblog.git"
"url": "https://git.bsd.gay/nyanogang/nyanoblog.git"
},
"author": "anna <owo@fef.moe>",
"license": "AGPL-3.0",

16
scripts/gen-migration Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
scriptdir="$(cd -- "$(dirname "$0")" || exit 1 ; pwd -P)"
timestamp="$(date -u +%Y%m%d%H%M%S)"
name="$1"
[ ! "$name" ] && echo >&2 "Usage: $0 <migration_name>" && exit 1
cat > "${scriptdir}/../migrate/${timestamp}_${name}.sql" <<EOF
BEGIN TRANSACTION;
-- write your stuff here
INSERT INTO __nyano_migrations (id) VALUES ('${timestamp}_${name}');
END TRANSACTION;
EOF