Restructure scripts into dev/ and prod/ for the devcontainer
- scripts/prod: entrypoint, db-setup and schema.sql shipped in the image - scripts/dev: seed/clear db, psql and cleanup, run natively in the devcontainer instead of via docker-compose - move setup.cfg to the repo root so linters pick it up - Makefile targets run directly in the devcontainer Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7c2b9fb3f4
commit
9895017385
10 files changed
+36
-30
No files matched your search
@@ -1,4 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
printf "Black:\n"
|
||||
black max/
|
||||
printf "\nIsort:\n"
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
PGPASSWORD="$PGSQL_PASSWORD" psql -v ON_ERROR_STOP=1 -h "$PGSQL_HOST" -p "$PGSQL_PORT" -U "$PGSQL_USER" -d "$PGSQL_NAME" \
|
||||
-c "DROP SCHEMA public CASCADE; CREATE SCHEMA public;"
|
||||
@@ -1,2 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
PGPASSWORD="$PGSQL_PASSWORD" psql -h "$PGSQL_HOST" -p "$PGSQL_PORT" -U "$PGSQL_USER" -d "$PGSQL_NAME"
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
source ../prod/db-setup.sh
|
||||
|
||||
flask add-domain finn.st
|
||||
flask add-domain stutzenste.in
|
||||
flask reset-admin admin@finn.st admin
|
||||
@@ -15,6 +15,6 @@ wait-for-it --timeout=15 "$PGSQL_HOST:$PGSQL_PORT"
|
||||
|
||||
# Create schema in postgresql
|
||||
export PGPASSWORD="$PGSQL_PASSWORD"
|
||||
psql -1 -h "$PGSQL_HOST" -p "$PGSQL_PORT" -U "$PGSQL_USER" -d "$PGSQL_NAME" -f max/db/schema.sql
|
||||
psql -1 -v ON_ERROR_STOP=1 -h "$PGSQL_HOST" -p "$PGSQL_PORT" -U "$PGSQL_USER" -d "$PGSQL_NAME" -f "$(dirname "${BASH_SOURCE[0]}")/schema.sql"
|
||||
|
||||
echo "end db setup"
|
||||
File renamed without changes.
@@ -0,0 +1,31 @@
|
||||
CREATE TABLE IF NOT EXISTS domains (
|
||||
name varchar PRIMARY KEY
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS emails (
|
||||
id serial PRIMARY KEY,
|
||||
email varchar(255) NOT NULL UNIQUE
|
||||
);
|
||||
|
||||
-- Make emails unique by lower-case comparison
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS email_unique_idx on emails (LOWER(email));
|
||||
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id serial PRIMARY KEY,
|
||||
email_id integer REFERENCES emails(id) ON DELETE RESTRICT NOT NULL UNIQUE,
|
||||
passwordhash varchar(255) NOT NULL,
|
||||
enabled boolean NOT NULL DEFAULT TRUE,
|
||||
is_admin boolean NOT NULL DEFAULT FALSE,
|
||||
can_use_different_alias_domain boolean NOT NULL DEFAULT FALSE,
|
||||
note text NOT NULL DEFAULT ''
|
||||
);
|
||||
|
||||
-- source=me2@finn.st destination=me@finn.st: me2 is an alias of me
|
||||
CREATE TABLE IF NOT EXISTS aliases (
|
||||
id serial PRIMARY KEY,
|
||||
source_email_id integer REFERENCES emails(id) ON DELETE RESTRICT NOT NULL,
|
||||
destination_user_id integer REFERENCES users(id) ON DELETE RESTRICT NOT NULL,
|
||||
enabled boolean NOT NULL DEFAULT TRUE,
|
||||
note text,
|
||||
UNIQUE(source_email_id, destination_user_id)
|
||||
);
|
||||
@@ -1,13 +0,0 @@
|
||||
[flake8]
|
||||
max_line_length = 96
|
||||
|
||||
[isort]
|
||||
include_trailing_comma = true
|
||||
multi_line_output = 3
|
||||
lines_after_imports = 2
|
||||
combine_as_imports = true
|
||||
force_grid_wrap = 0
|
||||
use_parentheses = true
|
||||
line_length = 88
|
||||
known_first_party = max
|
||||
known_third_party = flask
|
||||
Reference in new issue
Block a user