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,31 +0,0 @@
-- While this does not use the realtime backend, for brevity, we include this table here, as well.
DROP TABLE IF EXISTS voicemail_messages;
CREATE TABLE voicemail_messages (
-- Logical directory
dir CHAR(255),
-- Message number within the logical directory
msgnum INT(4),
-- Dialplan context
context CHAR(80),
-- Dialplan context, if Voicemail was invoked from a macro
macrocontext CHAR(80),
-- CallerID, when the message was left
callerid CHAR(80),
-- Date when the message was left, in Unixtime
origtime INT(11),
-- Length of the message, in seconds
duration INT(11),
-- The recording itself
recording BLOB,
-- Text flags indicating urgency of the message
flag CHAR(30),
-- Value of channel variable VM_CATEGORY, if set
category CHAR(30),
-- Owner of the mailbox
mailboxuser CHAR(30),
-- Context of the owner of the mailbox
mailboxcontext CHAR(30),
-- Unique ID of the message,
msg_id char(40),
PRIMARY KEY (dir, msgnum)
);