WIP switching to pgsql
This commit is contained in:
parent
e40f12085b
commit
d1c1f330c5
7
initpg.sh
Executable file
7
initpg.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
source ./pg.env
|
||||||
|
|
||||||
|
pg_ctl init
|
||||||
|
|
||||||
|
mkdir -p "$PGDATA/sockets"
|
||||||
|
echo "unix_socket_directories = 'sockets'" >> "$PGDATA/postgresql.conf"
|
||||||
|
echo "listen_addresses = ''" >> "$PGDATA/postgresql.conf"
|
4
pg.env
Normal file
4
pg.env
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export PGDATA="$PWD/pgdata"
|
||||||
|
export PGHOST="$PGDATA/sockets"
|
||||||
|
export PGDATABASE="postgres"
|
||||||
|
export PGUSER="$USER"
|
27
phrasedb.sql
27
phrasedb.sql
@ -1,12 +1,25 @@
|
|||||||
CREATE TABLE IF NOT EXISTS phrases (
|
DROP TABLE phrases;
|
||||||
id INTEGER PRIMARY KEY,
|
DROP TABLE sources;
|
||||||
sourceid INTEGER,
|
DROP TABLE CORPORA;
|
||||||
phrase TEXT UNIQUE,
|
|
||||||
|
|
||||||
FOREIGN KEY (sourceid) REFERENCES sources(sourceid)
|
CREATE TABLE IF NOT EXISTS corpora (
|
||||||
|
id char(7) PRIMARY KEY,
|
||||||
|
name TEXT UNIQUE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS sources (
|
CREATE TABLE IF NOT EXISTS sources (
|
||||||
id INTEGER PRIMARY KEY,
|
id char(7) PRIMARY KEY,
|
||||||
name TEXT UNIQUE
|
corpusid char(7) NOT NULL,
|
||||||
|
name TEXT UNIQUE,
|
||||||
|
|
||||||
|
FOREIGN KEY (corpusid) REFERENCES corpora(id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS phrases (
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
sourceid char(7) NOT NULL,
|
||||||
|
phrase TEXT,
|
||||||
|
|
||||||
|
FOREIGN KEY (sourceid) REFERENCES sources(id) ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
5
startpg.sh
Executable file
5
startpg.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ./pg.env
|
||||||
|
|
||||||
|
pg_ctl start
|
Loading…
x
Reference in New Issue
Block a user