I struggle with a similar problem. I don't think there is a way to perform 
large updates via studio. I've resorted to using console.sh. Even that is 
cumbersome and doesn't work as documented. The doc 
here: http://orientdb.com/docs/last/Console-Commands.html says that you 
should be able do do something like 'console.<sh|bat> commands.txt'. That 
doesn't seem to work as console starts up and then  tries to run 
commands.txt as the command.  But I digress...

My solution has been to create a commands.txt file with contents like:

set ignoreErrors true;
DROP DATABASE remote:localhost/<DBNAME> admin admin;
set ignoreErrors false;

# Create the database as plocal for persistent storage;
CREATE DATABASE remote:localhost/<DBNAME> admin admin plocal graph;

CREATE CLASS <YourClass> extends V;

CREATE PROPERTY <YourClass>.<NAME> string;
ALTER PROPERTY <YourClass>.<NAME> MANDATORY=true;
ALTER PROPERTY <YourClass>.<NAME> NOTNULL=true;
--->8 snip 8<---

There are more things in it to create more classes which extend V and 
others that extend E.

Then, I execute the script as such:

$ /path/to/orientdb/bin/console.sh `cat /path/to/commands.txt`
NOTES:
- Those are back-ticks around the `cat /path/to/commands.txt` such that it 
ends up being the commands which will be run in console.
- Using this method is subject to command line length limits... Which means 
that I've broken some things up into multiple files to do this.

I'm attempting to do something with the REST API, but that's not as 
functional as I had hoped. I thought I could collapse the CREATE 
PROPERTY/ALTER PROPERTY commands into a single JSON post, but that doesn't 
seem to work either.

Hopefully my commands.txt is useful to you and the rest doesn't distract 
too much.

-Tim

On Friday, September 18, 2015 at 9:46:37 AM UTC-5, Gururaj Kulkarni wrote:
>
> Hi,
>
> I have to create a script to create the schema which has few columns with 
> NotNull, min, max etc. So could you please provide example script which I 
> can refer to create schema using the studio.
> I have searched on google but couldn't find much information.
>
> Thanks,
> Guru
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to