2 Replies Latest reply on Nov 3, 2008 11:18 AM by JasonMH

    Release AIR application w/ database template

    JayStang Level 1
      Hey Guys,
      I've just finished developing my first adobe air application and now i'm ready to export a release build of it.

      I have a SQLLite database that i'm using w/ it. My question is, is there a way to package up an existing "database template" (an empty database w/ all the existing tables and columns created) with the installer rather then writting scripts to create the database the first time the application runs?
        • 1. Re: Release AIR application w/ database template
          Admiral_Brodnack Level 1
          Yes, you can include the template in the AIR package. There's various ways to do this, depending on which tools you use to package your application.

          When your application starts, you should check whether the database exists in the application storage directory. If not, you copy the template from the installed location first. And then start using it.
          • 2. Re: Release AIR application w/ database template
            JasonMH Level 1
            I do this as well. You can just add a folder for storing the database somewhere within your src directory and it will get compiled into the app. At runtime you can then use File.applicationDirectory.nativePath to open that file and copy it to the users documents folder or wherever you want.

            one suggestion - it's helpful to include in your schema somewhere a record or something that indicates your db version. even if you don't plan on using that now, if you ever update your app and require a DB update, it's extremely helpful to have a version number so you can verify that the user is running the right version and then run an update script or something.