# VMware ThinApp Factory
# Copyright (c) 2009-2013 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from migrate import *

# webui schema - Generated by create_model
# using Hibernate-generated schema as of appfactory commit
# 32bf463771617bf4499888891fde85ad462af767
meta = MetaData()

def idField(*args, **kwargs):
   return Column('_id', BigInteger(), Sequence('hibernate_sequence'), *args, primary_key=True, nullable=False, **kwargs)

def commonFields(*args, **kwargs):
   return (idField(*args, **kwargs),
           Column('_created', BigInteger(), nullable=False),
           Column('_modified', BigInteger(), nullable=False))

appdownload_cols = commonFields() + (
   Column('_appname', String(255)),
   Column('_appversion', String(255)),
   Column('_description', String(4096)),
   Column('_hash_function', Integer()),
   Column('_hash_value', String(255)),
   Column('_name', String(255)),
   Column('_url', String(255)),
   Column('_absoluteurl', String(255)),
   Column('_application__id', BigInteger(), ForeignKey('application._id')),
)
appdownload = Table('appdownload', meta, *appdownload_cols)

appicon_cols = commonFields() + (
   Column('_contenttype', String(255), nullable=False),
   Column('_size', Integer(), nullable=False),
   Column('_url', String(255), nullable=False),
   Column('_application__id', BigInteger(), ForeignKey('application._id')),
)
appicon = Table('appicon', meta, *appicon_cols)

appinstall_cols = commonFields() + (
   Column('_command', String(255), nullable=False),
   Column('_application__id', BigInteger(), ForeignKey('application._id')),
)
appinstall = Table('appinstall', meta, *appinstall_cols)

application_cols = commonFields() + (
   Column('_architecture', Integer(), nullable=False),
   Column('_categoriesencoded', String(1024), nullable=False),
   Column('_desc_content', String(255)),
   Column('_desc_content_type', String(255)),
   Column('_installerrev', String(255), nullable=False),
   Column('_locale', String(255), nullable=False),
   Column('_name', String(255), nullable=False),
   Column('_vendor', String(255), nullable=False),
   Column('_version', String(255), nullable=False),
   Column('_buildrequeststotal', BigInteger(), nullable=False),
   Column('_eula_content', String(255)),
   Column('_eula_content_type', String(255)),
   Column('_failcount', BigInteger(), nullable=False),
   Column('_fullpathtoinstaller', String(255)),
   Column('_lastremoteupdate', BigInteger(), nullable=False),
   Column('_overridemetadata', Boolean(), nullable=False),
   Column('_skipped', Boolean(), nullable=False),
   Column('_datasource__id', BigInteger(), ForeignKey('datasource._id')),
)
application = Table('application', meta, *application_cols)

build_cols = commonFields() + (
   Column('_architecture', Integer(), nullable=False),
   Column('_categoriesencoded', String(1024), nullable=False),
   Column('_desc_content', String(255)),
   Column('_desc_content_type', String(255)),
   Column('_installerrev', String(255), nullable=False),
   Column('_locale', String(255), nullable=False),
   Column('_name', String(255), nullable=False),
   Column('_vendor', String(255), nullable=False),
   Column('_version', String(255), nullable=False),
   Column('_buildname', String(255), nullable=False),
   Column('_built', BigInteger(), nullable=False),
   Column('_converterprojectid', BigInteger()),
   Column('_datastoreid', BigInteger()),
   Column('_published', BigInteger(), nullable=False),
   Column('_settingsedited', BigInteger(), nullable=False),
   Column('_status', String(255), nullable=False),
   Column('_subdir', String(255)),
)
build = Table('build', meta, *build_cols)

buildfile_cols = commonFields() + (
   Column('_exename', String(255), nullable=False),
   Column('_size', BigInteger(), nullable=False),
   Column('_url', String(255), nullable=False),
   Column('_build__id', BigInteger(), ForeignKey('build._id')),
)
buildfile = Table('buildfile', meta, *buildfile_cols)

buildicon_cols = commonFields() + (
   Column('_contenttype', String(255), nullable=False),
   Column('_size', Integer(), nullable=False),
   Column('_url', String(255), nullable=False),
   Column('_build__id', BigInteger(), ForeignKey('build._id')),
)
buildicon = Table('buildicon', meta, *buildicon_cols)

configsetting_cols = commonFields() + (
   Column('_key', String(255), nullable=False, unique=True),
   Column('_value', String(255), nullable=False),
)
configsetting = Table('configsetting', meta, *configsetting_cols)

datasource_cols = commonFields() + (
   Column('_failure_details', String(4096)),
   Column('_failure_summary', String(512)),
   Column('_lastconversion', BigInteger(), nullable=False),
   Column('_lastscan', BigInteger(), nullable=False),
   Column('_name', String(255), nullable=False, unique=True),
   Column('_oktoconvert', Boolean(), nullable=False),
   Column('_oktoscan', Boolean(), nullable=False),
   Column('_password', String(255)),
   Column('_type', String(255), nullable=False),
   Column('_username', String(255)),
)
datasource = Table('datasource', meta, *datasource_cols)

feed_cols = (
   Column('_desc_content', String(4096)),
   Column('_desc_content_type', String(128)),
   Column('_lastremotechange', BigInteger(), nullable=False),
   Column('_url', String(255), nullable=False),
   idField(ForeignKey('datasource._id')),
)
feed = Table('feed', meta, *feed_cols)

fileshare_cols = (
   Column('_datastorename', String(255), nullable=False),
   Column('_datastoreid', BigInteger(), nullable=False),
   Column('_description', String(255), nullable=False),
   Column('_serverpath', String(4096), nullable=False),
   Column('_status', String(255), nullable=False),
   idField(ForeignKey('datasource._id')),
)
fileshare = Table('fileshare', meta, *fileshare_cols)

recipe_cols = commonFields() + (
   Column('_desc_content', String(255)),
   Column('_desc_content_type', String(255)),
   Column('_name', String(255), nullable=False),
   Column('_datasource__id', BigInteger(), ForeignKey('datasource._id')),
)
recipe = Table('recipe', meta, *recipe_cols)
recipe__datasource__id__name_key = UniqueConstraint('_datasource__id', '_name', table=recipe)

recipe_recipestep = Table('recipe_recipestep', meta,
   Column('recipe__id', BigInteger(), ForeignKey('recipe._id'), Sequence('hibernate_sequence'), primary_key=True, nullable=False),
   Column('_steps__id', BigInteger(), ForeignKey('recipestep._id'), nullable=False, unique=True),
   Column('_steps_key', String(255), primary_key=True, nullable=False),
)

recipeappkey_cols = commonFields() + (
   Column('_installerrevision', String(255)),
   Column('_locale', String(255)),
   Column('_name', String(255)),
   Column('_version', String(255)),
   Column('_recipe__id', BigInteger(), ForeignKey('recipe._id'), Sequence('hibernate_sequence')),
   Column('_reference', String(255)),
)
recipeappkey = Table('recipeappkey', meta, *recipeappkey_cols)

recipecommand_cols = commonFields() + (
   Column('_command', String(4096), nullable=False),
   Column('_label', String(255), nullable=False),
   Column('_recipestep__id', BigInteger(), ForeignKey('recipestep._id')),
)
recipecommand = Table('recipecommand', meta, *recipecommand_cols)

recipefile_cols = commonFields() + (
   Column('_appname', String(255)),
   Column('_appversion', String(255)),
   Column('_description', String(4096)),
   Column('_hash_function', Integer()),
   Column('_hash_value', String(255)),
   Column('_name', String(255)),
   Column('_absoluteurl', String(255)),
   Column('_url', String(255)),
   Column('_recipe__id', BigInteger(), ForeignKey('recipe._id')),
)
recipefile = Table('recipefile', meta, *recipefile_cols)

recipestep_cols = commonFields()
recipestep = Table('recipestep', meta, *recipestep_cols)

recipevariable_cols = commonFields() + (
   Column('_name', String(255), nullable=False),
   Column('_pattern', String(255)),
   Column('_required', Boolean(), nullable=False),
   Column('_recipe__id', BigInteger(), ForeignKey('recipe._id')),
)
recipevariable = Table('recipevariable', meta, *recipevariable_cols)

UI_TABLES = [appdownload, appicon, appinstall, application, build, buildfile,
             buildicon, configsetting, datasource, feed, fileshare, recipe,
             recipe_recipestep, recipecommand, recipefile, recipestep,
             recipevariable]

def upgrade(migrate_engine):
   meta.create_all(migrate_engine)

def downgrade(migrate_engine):
   # Dangerous!
   meta.drop_all(migrate_engine)

# VMware ThinApp Factory
# Copyright (c) 2009-2013 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from migrate import *

# webui schema - Generated by create_model
# using Hibernate-generated schema as of appfactory commit
# 32bf463771617bf4499888891fde85ad462af767
meta = MetaData()

def idField(*args, **kwargs):
   return Column('_id', BigInteger(), Sequence('hibernate_sequence'), *args, primary_key=True, nullable=False, **kwargs)

def commonFields(*args, **kwargs):
   return (idField(*args, **kwargs),
           Column('_created', BigInteger(), nullable=False),
           Column('_modified', BigInteger(), nullable=False))

appdownload_cols = commonFields() + (
   Column('_appname', String(255)),
   Column('_appversion', String(255)),
   Column('_description', String(4096)),
   Column('_hash_function', Integer()),
   Column('_hash_value', String(255)),
   Column('_name', String(255)),
   Column('_url', String(255)),
   Column('_absoluteurl', String(255)),
   Column('_application__id', BigInteger(), ForeignKey('application._id')),
)
appdownload = Table('appdownload', meta, *appdownload_cols)

appicon_cols = commonFields() + (
   Column('_contenttype', String(255), nullable=False),
   Column('_size', Integer(), nullable=False),
   Column('_url', String(255), nullable=False),
   Column('_application__id', BigInteger(), ForeignKey('application._id')),
)
appicon = Table('appicon', meta, *appicon_cols)

appinstall_cols = commonFields() + (
   Column('_command', String(255), nullable=False),
   Column('_application__id', BigInteger(), ForeignKey('application._id')),
)
appinstall = Table('appinstall', meta, *appinstall_cols)

application_cols = commonFields() + (
   Column('_architecture', Integer(), nullable=False),
   Column('_categoriesencoded', String(1024), nullable=False),
   Column('_desc_content', String(255)),
   Column('_desc_content_type', String(255)),
   Column('_installerrev', String(255), nullable=False),
   Column('_locale', String(255), nullable=False),
   Column('_name', String(255), nullable=False),
   Column('_vendor', String(255), nullable=False),
   Column('_version', String(255), nullable=False),
   Column('_buildrequeststotal', BigInteger(), nullable=False),
   Column('_eula_content', String(255)),
   Column('_eula_content_type', String(255)),
   Column('_failcount', BigInteger(), nullable=False),
   Column('_fullpathtoinstaller', String(255)),
   Column('_lastremoteupdate', BigInteger(), nullable=False),
   Column('_overridemetadata', Boolean(), nullable=False),
   Column('_skipped', Boolean(), nullable=False),
   Column('_datasource__id', BigInteger(), ForeignKey('datasource._id')),
)
application = Table('application', meta, *application_cols)

build_cols = commonFields() + (
   Column('_architecture', Integer(), nullable=False),
   Column('_categoriesencoded', String(1024), nullable=False),
   Column('_desc_content', String(255)),
   Column('_desc_content_type', String(255)),
   Column('_installerrev', String(255), nullable=False),
   Column('_locale', String(255), nullable=False),
   Column('_name', String(255), nullable=False),
   Column('_vendor', String(255), nullable=False),
   Column('_version', String(255), nullable=False),
   Column('_buildname', String(255), nullable=False),
   Column('_built', BigInteger(), nullable=False),
   Column('_converterprojectid', BigInteger()),
   Column('_datastoreid', BigInteger()),
   Column('_published', BigInteger(), nullable=False),
   Column('_settingsedited', BigInteger(), nullable=False),
   Column('_status', String(255), nullable=False),
   Column('_subdir', String(255)),
)
build = Table('build', meta, *build_cols)

buildfile_cols = commonFields() + (
   Column('_exename', String(255), nullable=False),
   Column('_size', BigInteger(), nullable=False),
   Column('_url', String(255), nullable=False),
   Column('_build__id', BigInteger(), ForeignKey('build._id')),
)
buildfile = Table('buildfile', meta, *buildfile_cols)

buildicon_cols = commonFields() + (
   Column('_contenttype', String(255), nullable=False),
   Column('_size', Integer(), nullable=False),
   Column('_url', String(255), nullable=False),
   Column('_build__id', BigInteger(), ForeignKey('build._id')),
)
buildicon = Table('buildicon', meta, *buildicon_cols)

configsetting_cols = commonFields() + (
   Column('_key', String(255), nullable=False, unique=True),
   Column('_value', String(255), nullable=False),
)
configsetting = Table('configsetting', meta, *configsetting_cols)

datasource_cols = commonFields() + (
   Column('_failure_details', String(4096)),
   Column('_failure_summary', String(512)),
   Column('_lastconversion', BigInteger(), nullable=False),
   Column('_lastscan', BigInteger(), nullable=False),
   Column('_name', String(255), nullable=False, unique=True),
   Column('_oktoconvert', Boolean(), nullable=False),
   Column('_oktoscan', Boolean(), nullable=False),
   Column('_password', String(255)),
   Column('_type', String(255), nullable=False),
   Column('_username', String(255)),
)
datasource = Table('datasource', meta, *datasource_cols)

feed_cols = (
   Column('_desc_content', String(4096)),
   Column('_desc_content_type', String(128)),
   Column('_lastremotechange', BigInteger(), nullable=False),
   Column('_url', String(255), nullable=False),
   idField(ForeignKey('datasource._id')),
)
feed = Table('feed', meta, *feed_cols)

fileshare_cols = (
   Column('_datastorename', String(255), nullable=False),
   Column('_datastoreid', BigInteger(), nullable=False),
   Column('_description', String(255), nullable=False),
   Column('_serverpath', String(4096), nullable=False),
   Column('_status', String(255), nullable=False),
   idField(ForeignKey('datasource._id')),
)
fileshare = Table('fileshare', meta, *fileshare_cols)

recipe_cols = commonFields() + (
   Column('_desc_content', String(255)),
   Column('_desc_content_type', String(255)),
   Column('_name', String(255), nullable=False),
   Column('_datasource__id', BigInteger(), ForeignKey('datasource._id')),
)
recipe = Table('recipe', meta, *recipe_cols)
recipe__datasource__id__name_key = UniqueConstraint('_datasource__id', '_name', table=recipe)

recipe_recipestep = Table('recipe_recipestep', meta,
   Column('recipe__id', BigInteger(), ForeignKey('recipe._id'), Sequence('hibernate_sequence'), primary_key=True, nullable=False),
   Column('_steps__id', BigInteger(), ForeignKey('recipestep._id'), nullable=False, unique=True),
   Column('_steps_key', String(255), primary_key=True, nullable=False),
)

recipeappkey_cols = commonFields() + (
   Column('_installerrevision', String(255)),
   Column('_locale', String(255)),
   Column('_name', String(255)),
   Column('_version', String(255)),
   Column('_recipe__id', BigInteger(), ForeignKey('recipe._id'), Sequence('hibernate_sequence')),
   Column('_reference', String(255)),
)
recipeappkey = Table('recipeappkey', meta, *recipeappkey_cols)

recipecommand_cols = commonFields() + (
   Column('_command', String(4096), nullable=False),
   Column('_label', String(255), nullable=False),
   Column('_recipestep__id', BigInteger(), ForeignKey('recipestep._id')),
)
recipecommand = Table('recipecommand', meta, *recipecommand_cols)

recipefile_cols = commonFields() + (
   Column('_appname', String(255)),
   Column('_appversion', String(255)),
   Column('_description', String(4096)),
   Column('_hash_function', Integer()),
   Column('_hash_value', String(255)),
   Column('_name', String(255)),
   Column('_absoluteurl', String(255)),
   Column('_url', String(255)),
   Column('_recipe__id', BigInteger(), ForeignKey('recipe._id')),
)
recipefile = Table('recipefile', meta, *recipefile_cols)

recipestep_cols = commonFields()
recipestep = Table('recipestep', meta, *recipestep_cols)

recipevariable_cols = commonFields() + (
   Column('_name', String(255), nullable=False),
   Column('_pattern', String(255)),
   Column('_required', Boolean(), nullable=False),
   Column('_recipe__id', BigInteger(), ForeignKey('recipe._id')),
)
recipevariable = Table('recipevariable', meta, *recipevariable_cols)

UI_TABLES = [appdownload, appicon, appinstall, application, build, buildfile,
             buildicon, configsetting, datasource, feed, fileshare, recipe,
             recipe_recipestep, recipecommand, recipefile, recipestep,
             recipevariable]

def upgrade(migrate_engine):
   meta.create_all(migrate_engine)

def downgrade(migrate_engine):
   # Dangerous!
   meta.drop_all(migrate_engine)

# VMware ThinApp Factory # Copyright (c) 2009-2013 VMware, Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # #     http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # webui schema - Generated by create_model # using Hibernate-generated schema as of appfactory commit # 32bf463771617bf4499888891fde85ad462af767 # Dangerous!