Yii Framework Forum: Gii Update Database - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Gii Update Database Rate Topic: -----

#1 User is offline   kazuyahiko 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 21-March 13

Posted 24 March 2013 - 10:17 PM

temen temen yii sekalian saya mau tanya ni ketika kita menggunakan gii untuk generate model dan crud dari database
lalu setelah kita generate lalu tiba tiba ditengah jalan ada perubahan struktur relasi dan juga field yang ad di table
nahh itu gimana y cara mensiasatinya?
0

#2 User is offline   petra 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 218
  • Joined: 20-June 10

Posted 24 March 2013 - 10:22 PM

pake migration,

terus digenerate lagi aja giinya, khan ada 'diff'nya tuhg
0

#3 User is offline   Hermans 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 201
  • Joined: 17-February 11

Posted 12 April 2013 - 02:45 AM

View Postpetra, on 24 March 2013 - 10:22 PM, said:

pake migration,

terus digenerate lagi aja giinya, khan ada 'diff'nya tuhg


Ada link tutorial buat ini ? :)
0

#4 User is offline   Finzaiko 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 18-November 11
  • Location:Indonesia

Posted 17 April 2013 - 12:20 AM

selain cara om petra bisa juga dengan cara edit manual model dan viewnya

- tambahkan rules
public function rules()
	{
		return array(
			array('comments, name, video_idvideo, [b]field_baru[/b]', 'required'),
			.........
			array('idcomment, title, comments, comm_date, name, video_idvideo, [b]field_baru[/b]', 'safe', 'on'=>'search'), // atau bisa juga ditambah disini
		);


- tambahkan relationnya jika ada

public function relations()
	{
		return array(
        	'[b]mynewrelation[/b]' => array(self::BELONGS_TO, 'Kategori', 'video_idvideo'), // contoh penambahan relasi baru
			'videoIdvideo' => array(self::BELONGS_TO, 'Video', 'video_idvideo'),
		);
	}


trakhir tinggal edit viewnya
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users