Showing posts with label svn. Show all posts
Showing posts with label svn. Show all posts

Monday, March 2, 2009

How to svn checkout the xataface modules

Xataface by itself doesn't come with any modules to reduce the size of the download. But if you want to get some modules for your xataface, it is very simple!

You can checkout the repository for modules at:

http://weblite.ca/svn/dataface/modules/


There is a list of modules. Once you've decided to checkout a module, you can then do this through the command prompt using the 'svn checkout' command, or through the gui interface.

How to properly checkout xataface from svn command prompt

So to checkout from xataface from the command prompt, you can simply enter the command


svn checkout https://weblite.ca/svn/dataface/core/trunk


This will check everything that was in the trunk folder out and into a trunk folder.. However, if you want to say check it out into another folder you need to provide a parameter. So for example:

svn checkout https://weblite.ca/svn/dataface/core/trunk xataface


This will check everything out into the xataface folder (everything in the trunk folder).

Friday, November 28, 2008

Xataface svn repository

One good thing you should do if you are planning to develop an application with Xataface is to actually checkout the svn repository of Xataface. The most recent code for Xataface which includes bug fixes and features will be added to this repository. I used tortoiseSVN as my svn client, and to checkout you simply use this address:

http://weblite.ca/svn/dataface/core/trunk

Sunday, November 23, 2008

Keeping your database up to date throughout development

A major development issue in any computer project that requires a database is keeping your database structure keep to date with the different versions of the code. Keep database up to date is always a difficult because you cannot simply put it under version (thou technically you can because you can create an sql statement that represents the entire database). But Xataface provides an interesting way to handle this through the use of an Installer.php (make sure it's capital I) class in the conf folder.

The idea behind this is your application will be associated with a version number which you specify in the database. And then Xataface will run the Installer.php file which checks which version is in the database, and then it will call a bunch of functions that update the database table. The functions are named after the version number they should be applied to. So for example:


<?php
class conf_Installer {
function update_582(){
$sql[] = 'ALTER TABLE `webpage_sites` ADD `dynamic` TINYINT(1) AFTER `require_approval`';
$sql[] = 'ALTER TABLE `webpage_sites` ADD `irrelevant_get_params` TEXT NULL AFTER `aliases` , ADD `relevant_get_params` TEXT NULL AFTER `irrelevant_get_params`';
foreach ($sql as $q){
mysql_query($q, df_db());
}
}
?>


What happens is it will see if the database version is 582 or above and then it will apply this change to the database. The this general function format can be used for any version numbers.

To actually setup the database version, we don't actually need to setup a separate database table to handle this. We make a version.txt file in the application and xataface will create a version table in the database for us. The contents of the file will look like this:


0.1 680


The 0.1 really means nothing. It is simply used to note which major release we are on. It is the second number that means something. That is the exact version number that gets stored into the database.

And by setting up these two things, it becomes extremely easy to manage the database in xataface!

Saturday, November 22, 2008

SVN committing

This isn't exactly a Xataface related issue, but I found myself continually forgetting about this that I thought it would be good to blog about this so I can remember. When I have ssh'ed onto the server and I need to do a svn commit, I get an error message about not having an editor to input my svn commit message. The following piece of code fixes this:


export EDITOR=vi


Where vi is the editor program we are using. If you have something else installed on your server (and hopefully you do because vi really blows), then you can just use that.

Update: You can actually avoid having to do this by adding that exact line into your .bash_profile file. This file gets executed upon log in and runs a set of commands. So if you do this, it will always just set your editor and you won't have to worry about it anymore.