Re: Add new fields to a database table
Check out the schema system chapter in the book: http://book.cakephp.org/3.0/en/orm/schema-system.html It contains some of the methods needed to generate tables. You can also use a migrations system such as phinx. On Friday, May 1, 2015 at 10:54:33 PM UTC+2, r...@trinoweb.com wrote: > > I'd actually like an answer to the question, as I do need it. Please no > "you shouldn't do that", I need to do that >> >> -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Add new fields to a database table
I'd actually like an answer to the question, as I do need it. Please no "you shouldn't do that", I need to do that > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Add new fields to a database table
On Aug 12, 2011, at 15:29, aortizhi wrote: > On Aug 11, 5:30 pm, Ryan Schmidt wrote: >> On Aug 10, 2011, at 11:45, aortizhi wrote: >> >>> Hi eveyone, i'm new working with cakephp. I would like to know how can >>> i let my webapp's users add new fields to a table in my data base but >>> while is in production. >> >> That's not usually done. Why do you believe you want to do this? What >> problem are you trying to solve? Perhaps there is a better way. > > that's an application's request made for the client. He would like to > add new information to a table or many tables because there could be > more information in the future that may came out. Clients often request things without knowing what they're talking about. :) It's up to you as the developer to translate their need into a technical solution that makes sense within the context of the development environment you're using. As you're no doubt aware, the usual way to write an app with CakePHP is for the CakePHP app to have intimate knowledge of the database. Each database table is represented by a CakePHP model file, and each column in the table has specific settings in the model, regarding validation and so forth. And each view that deals with this model knows about those fields as well and has specific ways and places to display them. It's completely outside the scope of this line of thinking to imagine a user being able to arbitrarily add a column to a table and have it just work without needing to also do a lot of reprogramming in the app's code. Not to mention that contemplating allowing a web user to alter a database table is just a nightmare in terms of security. The database user PHP is connecting with shouldn't even have permission to alter a table. If the user can add columns, can they also delete columns? What if they delete an essential column? No, clearly, allowing an end user to alter your database tables is not a course of action you should consider. So again: what is the table? What kind of information is in the table? What kind of additional information that is not in the table now does the client think they will need to add? Can you give examples? If I were designing an app that must allow the user to add arbitrary information to a record, I'd probably have two tables: one for the static information—the information each record will definitely have—and a second table for each additional piece of optional data a user might add. For example, consider an app for tracking houses for sale. I might have table "houses" with basic information about the house, and "house_extras" which would just have an additional key/value pair. There could be multiple house_extras records for each house record. They'd be linked by the house_id. Table houses ("house_id" is primary key) house_id: 5 house_address: 123 main street house_price: 123,456.00 Table house_extras ("house_id + key" is primary key, or at least has a unique index) house_id: 5 key: garden value: ugly house_id: 5 key: neighbors value: obnoxious -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Add new fields to a database table
that's an application's request made for the client. He would like to add new information to a table or many tables because there could be more information in the future that may came out. On Aug 11, 5:30 pm, Ryan Schmidt wrote: > On Aug 10, 2011, at 11:45, aortizhi wrote: > > > Hi eveyone, i'm new working with cakephp. I would like to know how can > > i let my webapp's users add new fields to a table in my data base but > > while is in production. > > That's not usually done. Why do you believe you want to do this? What problem > are you trying to solve? Perhaps there is a better way. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Add new fields to a database table
Agreed, unless you are creating some kind of database management web application there should be another way. On 11 Aug 2011, at 23:30, Ryan Schmidt wrote: > > On Aug 10, 2011, at 11:45, aortizhi wrote: > >> Hi eveyone, i'm new working with cakephp. I would like to know how can >> i let my webapp's users add new fields to a table in my data base but >> while is in production. > > That's not usually done. Why do you believe you want to do this? What problem > are you trying to solve? Perhaps there is a better way. > > > > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Add new fields to a database table
On Aug 10, 2011, at 11:45, aortizhi wrote: > Hi eveyone, i'm new working with cakephp. I would like to know how can > i let my webapp's users add new fields to a table in my data base but > while is in production. That's not usually done. Why do you believe you want to do this? What problem are you trying to solve? Perhaps there is a better way. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Add new fields to a database table
Hi eveyone, i'm new working with cakephp. I would like to know how can i let my webapp's users add new fields to a table in my data base but while is in production. Thank you -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php