Create structure without storing record / Check if table exists

77 views
Skip to first unread message

Patrick

unread,
Jul 12, 2014, 6:33:11 PM7/12/14
to redbe...@googlegroups.com
Is there an easy way to have RedBean create any needed tables / add any needed columns without storing a bean?

And a somewhat related question: is there an easy way to check and see if a table exists?

gabor

unread,
Jul 13, 2014, 3:31:20 AM7/13/14
to redbe...@googlegroups.com


This is easy to do:

Adding a column is as simple as invoking $writer->addColumn(), see documentation here:

http://redbeanphp.com/api/interface_red_bean_p_h_p_1_1_query_writer.html#ac7b4f710cab9bb5bb010c57ec8a4f276

To determine whether a table already exists, simply ask for all tables:

$tables = R::inspect();

cheers
Gabor
Reply all
Reply to author
Forward
0 new messages