db_postgres: use enum for sasl_mechanism
Ensures only supported mechanisms get stored in the DB. git-svn-id: file:///srv/svn/repo/suika/trunk@774 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This commit is contained in:
parent
f1b4a2bc79
commit
ec2d1bd2d8
@ -33,6 +33,8 @@ CREATE TABLE "User" (
|
||||
realname VARCHAR(255)
|
||||
);
|
||||
|
||||
CREATE TYPE sasl_mechanism AS ENUM ('PLAIN', 'EXTERNAL');
|
||||
|
||||
CREATE TABLE "Network" (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR(255),
|
||||
@ -43,7 +45,7 @@ CREATE TABLE "Network" (
|
||||
realname VARCHAR(255),
|
||||
pass VARCHAR(255),
|
||||
connect_commands VARCHAR(1023),
|
||||
sasl_mechanism VARCHAR(255),
|
||||
sasl_mechanism sasl_mechanism,
|
||||
sasl_plain_username VARCHAR(255),
|
||||
sasl_plain_password VARCHAR(255),
|
||||
sasl_external_cert BYTEA,
|
||||
@ -80,6 +82,13 @@ CREATE TABLE "DeliveryReceipt" (
|
||||
var postgresMigrations = []string{
|
||||
"", // migration #0 is reserved for schema initialization
|
||||
`ALTER TABLE "Network" ALTER COLUMN nick DROP NOT NULL`,
|
||||
`
|
||||
CREATE TYPE sasl_mechanism AS ENUM ('PLAIN', 'EXTERNAL');
|
||||
ALTER TABLE "Network"
|
||||
ALTER COLUMN sasl_mechanism
|
||||
TYPE sasl_mechanism
|
||||
USING sasl_mechanism::sasl_mechanism;
|
||||
`,
|
||||
}
|
||||
|
||||
type PostgresDB struct {
|
||||
|
Loading…
x
Reference in New Issue
Block a user