Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re: [jdgamble] How do I create a def file?

Quote Reply
Re: [jdgamble] How do I create a def file? In reply to
In simple terms, I was able to create a simple field using the perl script, then edit the fields using the tools GT already has (I don't know why they don't have tools already create tables, drop, etc that mess with def files too)...

Anyway, here is the script I used...

Code:
#!/usr/bin/perl #================================ use strict;
use lib 'admin path';
use Links qw/$IN $CFG $DB/;
Links::init('admin path'); local $SIG{__DIE__} = \&Links::fatal;
main(); sub main {
#---------------------------------------------------
# my ($table_name, $creator); $table_name = "Tricks"; $creator = $DB->creator($table_name); # create a dummy column

$creator->cols(
TrickID => {
pos => 1,
type => 'INT',
size => '10',
not_null => 1,
default => 0
}
); # set the primary key $creator->pk('TrickID'); # will not work if table exists $creator->create(); print $IN->header();
print qq|<a href="$CFG->{admin_root_url}/admin.cgi?do=editor_columns&db=$table_name">Go to Editor</a>|;
}

I could have covered errors etc, but I decided just to post the simple code for anyone's reference...

- Jonathan
Subject Author Views Date
Thread How do I create a def file? jdgamble 2777 Jan 27, 2005, 12:39 AM
Thread Re: [jdgamble] How do I create a def file?
Andy 2702 Jan 27, 2005, 2:44 AM
Thread Re: [Andy] How do I create a def file?
jdgamble 2677 Jan 27, 2005, 3:37 AM
Thread Re: [jdgamble] How do I create a def file?
jdgamble 2666 Jan 28, 2005, 5:56 AM
Post Re: [jdgamble] How do I create a def file?
jdgamble 2654 Jan 28, 2005, 7:25 PM
Post Re: [jdgamble] How do I create a def file?
HyperTherm 2632 Feb 5, 2005, 4:14 AM