I want RedBean to create unique keys / indexes when creating a schema. The following code - against how I understand the documentation - do not do this:
R :: Installation ('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();
}
What happens in sqlite ist this:
create table img (id integer primary key autoincrement, url)
What I expected was as follows:
create table img (id integer primary key autoincrement, url text unique)
Can this be done without writing SQL in RedBean?
andig source
share