Add database schema management using Alembic

This patch replaces contrib/realtime/ with a new setup for managing the
database schema required for database integration with Asterisk.  In
addition to initializing a database with the proper schema, alembic can do a
database migration to assist with upgrading Asterisk in the future.
Hopefully this helps make setting up and operating Asterisk with a database
easier.

With this the schema only needs to be maintained in one place instead of
once per database.  The schemas I have added here have a bit of improvement
over the examples that were there before (some added consistency and added
some missing indexes).  Managing the schema in one place here also applies
to all databases supported by SQLAlchemy.

See contrib/ast-db-manage/README.md for more details.

Review: https://reviewboard.asterisk.org/r/2731

patch by Russell Bryant (license 6300)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@397874 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Matthew Jordan
2013-08-28 20:55:31 +00:00
parent 0f61ca1b36
commit 402d4578ba
10 changed files with 10 additions and 517 deletions

View File

@@ -1,72 +0,0 @@
DROP TABLE IF EXISTS voicemail;
CREATE TABLE voicemail (
-- All of these column names are very specific, including "uniqueid". Do not change them if you wish voicemail to work.
uniqueid INT(5) NOT NULL AUTO_INCREMENT PRIMARY KEY,
-- Mailbox context.
context CHAR(80) NOT NULL DEFAULT 'default',
-- Mailbox number. Should be numeric.
mailbox CHAR(80) NOT NULL,
-- Must be numeric. Negative if you don't want it to be changed from VoicemailMain
password CHAR(80) NOT NULL,
-- Used in email and for Directory app
fullname CHAR(80),
-- Used for Directory app
alias CHAR(80),
-- Email address (will get sound file if attach=yes)
email CHAR(80),
-- Email address (won't get sound file)
pager CHAR(80),
-- Attach sound file to email - YES/no
attach CHAR(3),
-- Which sound format to attach
attachfmt CHAR(10),
-- Send email from this address
serveremail CHAR(80),
-- Prompts in alternative language
language CHAR(20),
-- Alternative timezone, as defined in voicemail.conf
tz CHAR(30),
-- Delete voicemail from server after sending email notification - yes/NO
deletevoicemail CHAR(3),
-- Read back CallerID information during playback - yes/NO
saycid CHAR(3),
-- Allow user to send voicemail from within VoicemailMain - YES/no
sendvoicemail CHAR(3),
-- Listen to voicemail and approve before sending - yes/NO
review CHAR(3),
-- Warn user a temporary greeting exists - yes/NO
tempgreetwarn CHAR(3),
-- Allow '0' to jump out during greeting - yes/NO
operator CHAR(3),
-- Hear date/time of message within VoicemailMain - YES/no
envelope CHAR(3),
-- Hear length of message within VoicemailMain - yes/NO
sayduration CHAR(3),
-- Minimum duration in minutes to say
saydurationm INT(3),
-- Force new user to record name when entering voicemail - yes/NO
forcename CHAR(3),
-- Force new user to record greetings when entering voicemail - yes/NO
forcegreetings CHAR(3),
-- Context in which to dial extension for callback
callback CHAR(80),
-- Context in which to dial extension (from advanced menu)
dialout CHAR(80),
-- Context in which to execute 0 or * escape during greeting
exitcontext CHAR(80),
-- Maximum messages in a folder (100 if not specified)
maxmsg INT(5),
-- Increase DB gain on recorded message by this amount (0.0 means none)
volgain DECIMAL(5,2),
-- IMAP user for authentication (if using IMAP storage)
imapuser VARCHAR(80),
-- IMAP password for authentication (if using IMAP storage)
imappassword VARCHAR(80),
-- IMAP server location (if using IMAP storage)
imapsever VARCHAR(80),
-- IMAP port (if using IMAP storage)
imapport VARCHAR(8),
-- IMAP flags (if using IMAP storage)
imapflags VARCHAR(80),
stamp timestamp
);