aboutsummaryrefslogtreecommitdiff
path: root/src/database.rs
diff options
context:
space:
mode:
authorKunoiSayami <[email protected]>2021-05-06 00:03:27 +0800
committerKunoiSayami <[email protected]>2021-05-06 00:03:27 +0800
commitcbc7b3810bfe8fa750e566e7db2166ef8b7fcad1 (patch)
tree91be52074dfb0652cbfefa05f5e9ca07001ce4a8 /src/database.rs
init
Diffstat (limited to 'src/database.rs')
-rw-r--r--src/database.rs43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/database.rs b/src/database.rs
new file mode 100644
index 0000000..1a1dedf
--- /dev/null
+++ b/src/database.rs
@@ -0,0 +1,43 @@
+/*
+ ** Copyright (C) 2021 KunoiSayami
+ **
+ ** This file is part of cgit-simple-authentication and is released under
+ ** the AGPL v3 License: https://www.gnu.org/licenses/agpl-3.0.txt
+ **
+ ** This program is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU Affero General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** any later version.
+ **
+ ** This program is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU Affero General Public License for more details.
+ **
+ ** You should have received a copy of the GNU Affero General Public License
+ ** along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+#[allow(dead_code)]
+pub mod v1 {
+ pub const CREATE_TABLES: &str = r#"
+ CREATE TABLE "accounts" (
+ "user" TEXT NOT NULL,
+ "password" TEXT NOT NULL,
+ PRIMARY KEY("user")
+ );
+
+
+ CREATE TABLE "auth_meta" (
+ "key" TEXT NOT NULL,
+ "value" TEXT NOT NULL,
+ PRIMARY KEY("key")
+ );
+
+ INSERT INTO "auth_meta" VALUES ('version', '1');
+ "#;
+
+ pub const VERSION: &str = "1";
+
+}
+pub use v1::VERSION;
+pub use v1 as current;