Skip to content

Commit

Permalink
TrstPrtn table create and migrate
Browse files Browse the repository at this point in the history
  • Loading branch information
kfl62 committed Jan 30, 2009
1 parent 60af427 commit 551e9e0
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 1 deletion.
55 changes: 55 additions & 0 deletions app/models/trst_prtn.rb
@@ -0,0 +1,55 @@
#==Baza de date :Tabel => <em>trst_prtns</em>
#Tabelul care conţine evidenţa documentelor generate de sistem şi/sau utilizatori
#* Fişier migrare: <b><em>RAILS_ROOT/db/migrate/xxx_create_trst_prtns</em></b>
# create_table "trst_prtns", :force => true do |t|
# t.string "prefix", :limit => 10, :default => "", :null => false
# t.string "name", :limit => 100, :default => "", :null => false
# t.string "suffix", :limit => 10, :default => "", :null => false
# t.string "namesh", :limit => 10, :default => "", :null => false
# t.string "id_chamcom", :limit => 25, :default => "", :null => false
# t.string "id_fiscal", :limit => 15, :default => "", :null => false
# t.string "id_itm", :limit => 15, :default => "", :null => false
# t.string "id_account", :limit => 15, :default => "", :null => false
# t.string "id_internet", :limit => 15, :default => "", :null => false
# t.string "adress", :limit => 100, :default => "", :null => false
# t.string "city", :limit => 30, :default => "", :null => false
# t.string "zip", :limit => 30, :default => "", :null => false
# t.string "state", :limit => 30, :default => "", :null => false
# t.integer "id_country", :limit => 4, :default => 0, :null => false
# t.string "contactpers", :limit => 30, :default => "", :null => false
# t.string "contactpers_q", :limit => 25, :default => "", :null => false
# t.string "tel", :limit => 30, :default => "", :null => false
# t.string "fax", :limit => 30, :default => "", :null => false
# t.string "email", :limit => 30, :default => "", :null => false
# t.string "webadress", :limit => 30, :default => "", :null => false
# t.boolean "flag_clb", :default => false, :null => false
# t.trst
# end
#În afara de câmpurile de mai sus se generează automat câmpul <b><em>t.integer "id"</em></b> de tip autoincrement,
#care de fapt reprezintă indexul tabelului.
#Linia <b><em>t.trsts</em></b> generează câmpurile implicite, prezente în fiecare tabel al aplicaţiei
#(vezi. clasa ActiveRecord::ConnectionAdapters::TableDefinition).
#==Descrierea câmpurilor:
#Câmp
# Descriere
#==Relaţia cu alte tabele
#de tipul "habtm" (HasAndBelongsToMany), polimorfice etc...
#
# Dacă este cazul ... :)
#==Rolul tabelului
#Descriere ....

class TrstPrtn < ActiveRecord::Base

def self.per_page
20
end

def name_long
prefix = self.prefix? ? self.prefix : 'S.C. ?'
name = self.name? ? self.name : '...?...'
suffix = self.suffix? ? self.suffix : 'S.R.L. ?'
return prefix + ' ' + name + ' ' + suffix
end

end
31 changes: 31 additions & 0 deletions db/migrate/20090130162621_create_trst_prtns.rb
@@ -0,0 +1,31 @@
class CreateTrstPrtns < ActiveRecord::Migration
def self.up
create_table :trst_prtns do |t|
t.string "prefix", :limit => 10, :default => "", :null => false
t.string "name", :limit => 100, :default => "", :null => false
t.string "suffix", :limit => 10, :default => "", :null => false
t.string "namesh", :limit => 10, :default => "", :null => false
t.string "id_chamcom", :limit => 25, :default => "", :null => false
t.string "id_fiscal", :limit => 15, :default => "", :null => false
t.string "id_itm", :limit => 15, :default => "", :null => false
t.string "id_account", :limit => 15, :default => "", :null => false
t.string "id_internet", :limit => 15, :default => "", :null => false
t.string "address", :limit => 100, :default => "", :null => false
t.string "city", :limit => 30, :default => "", :null => false
t.string "zip", :limit => 30, :default => "", :null => false
t.string "state", :limit => 30, :default => "", :null => false
t.integer "id_country", :limit => 4, :default => 0, :null => false
t.string "contactpers", :limit => 30, :default => "", :null => false
t.string "contactpers_q", :limit => 25, :default => "", :null => false
t.string "tel", :limit => 30, :default => "", :null => false
t.string "fax", :limit => 30, :default => "", :null => false
t.string "email", :limit => 30, :default => "", :null => false
t.string "webaddress", :limit => 30, :default => "", :null => false
t.trsts
end
end

def self.down
drop_table :trst_prtns
end
end
31 changes: 30 additions & 1 deletion db/schema.rb
Expand Up @@ -9,7 +9,36 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20090123023025) do
ActiveRecord::Schema.define(:version => 20090130162621) do

create_table "trst_prtns", :force => true do |t|
t.string "prefix", :limit => 10, :default => "", :null => false
t.string "name", :limit => 100, :default => "", :null => false
t.string "suffix", :limit => 10, :default => "", :null => false
t.string "namesh", :limit => 10, :default => "", :null => false
t.string "id_chamcom", :limit => 25, :default => "", :null => false
t.string "id_fiscal", :limit => 15, :default => "", :null => false
t.string "id_itm", :limit => 15, :default => "", :null => false
t.string "id_account", :limit => 15, :default => "", :null => false
t.string "id_internet", :limit => 15, :default => "", :null => false
t.string "adress", :limit => 100, :default => "", :null => false
t.string "city", :limit => 30, :default => "", :null => false
t.string "zip", :limit => 30, :default => "", :null => false
t.string "state", :limit => 30, :default => "", :null => false
t.integer "id_country", :limit => 4, :default => 0, :null => false
t.string "contactpers", :limit => 30, :default => "", :null => false
t.string "contactpers_q", :limit => 25, :default => "", :null => false
t.string "tel", :limit => 30, :default => "", :null => false
t.string "fax", :limit => 30, :default => "", :null => false
t.string "email", :limit => 30, :default => "", :null => false
t.string "webadress", :limit => 30, :default => "", :null => false
t.boolean "flag_clb", :default => false, :null => false
t.datetime "created_on"
t.integer "created_by", :limit => 6, :default => 0, :null => false
t.datetime "updated_on"
t.integer "updated_by", :limit => 6, :default => 0, :null => false
t.integer "approved_by", :limit => 6, :default => 0, :null => false
end

create_table "trst_sys_menus", :force => true do |t|
t.string "name", :limit => 15, :default => "Menu", :null => false
Expand Down
7 changes: 7 additions & 0 deletions test/fixtures/trst_prtns.yml
@@ -0,0 +1,7 @@
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html

# one:
# column: value
#
# two:
# column: value
8 changes: 8 additions & 0 deletions test/unit/trst_prtn_test.rb
@@ -0,0 +1,8 @@
require 'test_helper'

class TrstPrtnTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end

0 comments on commit 551e9e0

Please sign in to comment.