I'd like RedBean to create unique keys/indexes when generating the schema. The following code does- opposed to how I understand the documentation- not do this:
R::setup('sqlite:rss_loader.db3');
$bean = R::findOne(IMG);
if (!$bean->id) {
$bean = R::dispense(IMG);
$bean->setMeta("buildcommand.unique.0", array('url'));
$bean->url = 'text';
R::store($bean);
$bean->wipe();
R::freeze(); //no more schema changes!
}
What is happening in sqlite ist this:
create table img (id integer primary key autoincrement, url)
What I was expecting was this:
create table img (id integer primary key autoincrement, url text unique)
Can this be achieved without write SQL against RedBean?