Fix #2 issue
This commit is contained in:
pare
9924a33d2d
commit
ea2b418c6a
S'han modificat 1 arxius amb 6 adicions i 6 eliminacions
12
db-setup.py
12
db-setup.py
|
@ -1,7 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import pdb
|
|
||||||
import getpass
|
import getpass
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -70,14 +69,14 @@ def create_table(db, db_user, table, sql):
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
#############################################################################################
|
#############################################################################################
|
||||||
|
|
||||||
# Load configuration from config file
|
# Load configuration from config file
|
||||||
config_filepath = "config.txt"
|
config_filepath = "config.txt"
|
||||||
mastodon_db = get_parameter("mastodon_db", config_filepath) # E.g., mastodon_production
|
mastodon_db = get_parameter("mastodon_db", config_filepath) # E.g., mastodon_production
|
||||||
mastodon_db_user = get_parameter("mastodon_db_user", config_filepath) # E.g., mastodon
|
mastodon_db_user = get_parameter("mastodon_db_user", config_filepath) # E.g., mastodon
|
||||||
mailing_db = get_parameter("mailing_db", config_filepath) # E.g., inactive
|
mailing_db = get_parameter("mailing_db", config_filepath) # E.g., inactive
|
||||||
mailing_db_user = get_parameter("mailing_db_user", config_filepath) # E.g., mastodon
|
mailing_db_user = get_parameter("mailing_db_user", config_filepath) # E.g., mastodon
|
||||||
mailing_db_table = get_parameter("mailing_db_table", config_filepath) # E.g., inactive_users
|
mailing_db_table = get_parameter("mailing_db_table", config_filepath) # E.g., inactive_users
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# create database
|
# create database
|
||||||
|
@ -131,7 +130,7 @@ if conn is not None:
|
||||||
print("\n")
|
print("\n")
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# Create needed tables
|
# Create needed tables
|
||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
print("Creating table...")
|
print("Creating table...")
|
||||||
|
@ -141,8 +140,9 @@ print("Creating table...")
|
||||||
db = mailing_db
|
db = mailing_db
|
||||||
db_user = mailing_db_user
|
db_user = mailing_db_user
|
||||||
table = mailing_db_table
|
table = mailing_db_table
|
||||||
sql = """create table "+table+" (datetime timestamptz, account_id int primary key, username varchar(30), email varchar(50), emailed_at timestamptz, emailed boolean default False, deleted boolean default False,
|
sql = "create table " + table + "(datetime timestamptz, account_id int primary key, username varchar(30), email varchar(50), emailed_at timestamptz,"
|
||||||
elapse_days varchar(30), to_be_deleted boolean default False, recipient_error boolean default False, feedback boolean default False)"""
|
sql += "emailed boolean default False, deleted boolean default False, elapse_days varchar(30), to_be_deleted boolean default False,"
|
||||||
|
sql += "recipient_error boolean default False, feedback boolean default False)"
|
||||||
create_table(db, db_user, table, sql)
|
create_table(db, db_user, table, sql)
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
|
|
Loading…
Referencia en una nova incidència