Drupal supports multiple databases (MySQL, PostreSQL, SQLite, etc.) through its database abstraction
layer. Each module that wants to have a database table describes that table to Drupal using a schema
definition. Drupal then translates the definition into syntax that is appropriate for the database.
when you write a module that needs to create one or more database tables for
storage, the instructions to create and maintain the table structure go into an .install file that is
distributed with the module
During the installation of a new module, Drupal automatically checks to see whether a schema
definition exists in the modules .install file, If a schema definition exists, Drupal
creates the database table(s) defined within the schema. The following example demonstrates the
general structure of a schema definition.
$schema['tablename'] = array( // Table description. 'description' => t('Description of what the table is used for.'), 'fields' => array( // Field definition. 'field1' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => t('Description of what this field is used for.'), ), ), // Index declarations. 'primary key' => array('field1'), );
Field Type Mapping from Schema to Database
1.Varchar
The varchar, or variable length character field, is the most frequently used field type for storing text less
than 256 characters in length. A maximum length, in characters, is defined by the length key. MySQL
varchar field lengths are 0–255 characters (MySQL 5.0.2 and earlier) and 0–65,535 characters (MySQL
5.0.3 and later); PostgreSQL varchar field lengths may be larger.
$field['fieldname'] = array( 'type' => 'varchar', // Required. 'length' => 255, // Required. 'not null' => TRUE, // Defaults to FALSE. 'default' => 'chocolate', // See below. 'description' => t('Always state the purpose of your field.'), );
If the default key has not been set and the not null key has been set to FALSE, the default will be set
to NULL.
2.Char
Char fields are fixed-length character fields. The length of the field, in characters, is defined by the
length key. MySQL char field lengths are 0–255 characters.
$field['fieldname'] = array( 'type' => 'char', // Required. 'length' => 64, // Required. 'not null' => TRUE, // Defaults to FALSE. 'default' => 'strawberry', // See below. 'description' => t('Always state the purpose of your field.'), );
If the default key has not been set and the not null key has been set to FALSE, the default will be set
to NULL.
3.Text
Text fields are used for textual data that can be quite large. For example, the body field of the
node_revisions table (where node body text is stored) is of this type. Default values may not be used for
text fields.
$field['fieldname'] = array( 'type' => 'text', // Required. 'size' => 'small', // tiny | small | normal | medium | big 'not null' => TRUE, // Defaults to FALSE. 'description' => t('Always state the purpose of your field.'), );
4. Integer
This field type is used for storing integers, such as node IDs. If the unsigned key is TRUE, negative integers
will not be allowed.
$field['fieldname'] = array( 'type' => 'int', // Required. 'unsigned' => TRUE, // Defaults to FALSE. 'size' => 'small', // tiny | small | medium | normal | big 'not null' => TRUE, // Defaults to FALSE. 'description' => t('Always state the purpose of your field.'), );
5.Serial
A serial field keeps a number that increments. For example, when a node is added, the nid field of the
node table is incremented. This is done by inserting a row and calling db_last_insert_id(). If a row is
added by another thread between the insertion of a row and the retrieval of the last ID, the correct ID is
still returned because it is tracked on a per-connection basis. A serial field must be indexed; it is usually
indexed as the primary key.
$field['fieldname'] = array( 'type' => 'serial', // Required. 'unsigned' => TRUE, // Defaults to FALSE. Serial numbers are usually positive. 'size' => 'small', // tiny | small | medium | normal | big 'not null' => TRUE, // Defaults to FALSE. Typically TRUE for serial fields. 'description' => t('Always state the purpose of your field.'), );
6. Date and Time: Datetime
The Drupal core does not use this data type, preferring to use Unix timestamps in integer fields. The
datetime format is a combined format containing both the date and the time.
$field['fieldname'] = array( 'type' => 'datetime', // Required. 'not null' => TRUE, // Defaults to FALSE. 'description' => t('Always state the purpose of your field.'), );
7.Binary: Blob
The binary large object data (blob) type is used to store binary data (for example, Drupal’s cache table to
store the cached data). Binary data may include music, images, or video. Two sizes are available, normal
and big.
$field['fieldname'] = array( 'type' => 'blob', // Required. 'size' => 'normal' // normal | big 'not null' => TRUE, // Defaults to FALSE. 'description' => t('Always state the purpose of your field.'), );
Comments
Rickyapalk (not verified)
Wed, 2019-12-04 08:28
Permalink
does walgreens sell generic viagra
my web site - https://www.myonlinebuy.us/how-to-take-viagra-for-best-results
Ingrid (not verified)
Mon, 2020-08-24 23:31
Permalink
Add new comment | Moi Verhole
I simply couldn't go away your web site before suggesting that
I really enjoyed the usual info a person provide in your guests?
Is going to be again steadily in order to investigate cross-check new
posts
Feel free to surf to my page; senzori pescuit
AlfredoLow (not verified)
Fri, 2020-01-31 04:31
Permalink
online pharmacies mexico
http://tribtaiti.webcindario.com/ canadian pharmacy viagra
drugstore online canada http://tribtaiti.webcindario.com/
drugstore online reviews http://tribtaiti.webcindario.com/
AlfredoLow (not verified)
Sun, 2020-02-02 20:42
Permalink
trusted pharmacy canada scam
https://viagracwithoutdoctor.com/ drugstore online shopping
canadian government approved pharmacies https://viagracwithoutdoctor.com/
online pharmacies https://viagracwithoutdoctor.com/
Lida (not verified)
Tue, 2020-08-25 04:21
Permalink
Add new comment | Moi Verhole
What i don't realize is if truth be told how you're now not actually much more smartly-liked than you might be now.
You are very intelligent. You already know thus significantly in relation to this subject,
produced me personally believe it from numerous numerous angles.
Its like men and women aren't interested until it is something to do with Lady gaga!
Your personal stuffs great. Always take care of it up!
Feel free to surf to my homepage free the vbucks
Juli (not verified)
Tue, 2020-08-25 04:51
Permalink
Add new comment | Moi Verhole
Aw, this was a really good post. Finding the time and actual effort to create
a top notch article… but what can I say… I procrastinate a
lot and never seem to get anything done.
my blog free vbucks
AlfredoLow (not verified)
Sun, 2020-02-02 22:51
Permalink
pharmacy near me
https://canadianhpharmacy.com/ aarp recommended canadian pharmacies
canadian drugs https://canadianhpharmacy.com/
canada medication list https://canadianhpharmacy.com/
AlfredoLow (not verified)
Mon, 2020-02-03 00:02
Permalink
best canadian mail order pharmacies
https://viagrawwithoutdoctor.com/ canadian pharmacies that ship to us
canadian pharmaceuticals for usa sales https://viagrawwithoutdoctor.com/
canada medication https://viagrawwithoutdoctor.com/
Nell (not verified)
Tue, 2020-08-25 00:12
Permalink
Add new comment | Moi Verhole
Good replies in return of this question with solid arguments and explaining all concerning that.
Feel free to visit my web site; v bucks free
Maryann (not verified)
Tue, 2020-08-25 05:58
Permalink
Add new comment | Moi Verhole
hey there and thank you for your information – I've definitely picked up something new from right here.
I did however expertise a few technical issues using this website, as I experienced to
reload the website many times previous to I could get it to load properly.
I had been wondering if your web hosting is OK?
Not that I am complaining, but slow loading instances times will sometimes affect your placement
in google and could damage your high-quality score if advertising and marketing with Adwords.
Well I'm adding this RSS to my email and can look out for much more of your respective intriguing content.
Make sure you update this again soon.
Also visit my page free the vbucks
Tammy (not verified)
Tue, 2020-08-25 06:02
Permalink
Add new comment | Moi Verhole
Hmm is anyone else encountering problems with the
images on this blog loading? I'm trying to figure
out if its a problem on my end or if it's the blog.
Any suggestions would be greatly appreciated.
Feel free to visit my homepage - free vbucks generator
AlfredoLow (not verified)
Mon, 2020-02-03 01:10
Permalink
canada online pharmacy
https://canadianlpharmacy.com/ buy vistagra online safe
trust pharmacy canada https://canadianlpharmacy.com/
canadian pharmacy viagra https://canadianlpharmacy.com/
AlfredoLow (not verified)
Mon, 2020-02-03 02:14
Permalink
prescription drugs without prior prescription
https://viagrawwithoutdoctor.com/ canadian pharmacies that are legit
canada pharmaceuticals online https://viagrawwithoutdoctor.com/
canada medication list https://viagrawwithoutdoctor.com/
AlfredoLow (not verified)
Mon, 2020-02-03 03:16
Permalink
buy viagra 25mg
https://canadianlpharmacy.com/ canadian pharmacys
canada pharmacies https://canadianlpharmacy.com/
buy viagra online usa https://canadianlpharmacy.com/
Kazuko (not verified)
Tue, 2020-08-25 00:28
Permalink
Add new comment | Moi Verhole
Woah! I'm really enjoying the template/theme of this website.
It's simple, yet effective. A lot of times it's
tough to get that "perfect balance" between usability and visual appeal.
I must say that you've done a fantastic job with this. Additionally, the blog loads extremely quick for me on Internet explorer.
Exceptional Blog!
Take a look at my blog post: free v bucks
AlfredoLow (not verified)
Mon, 2020-02-03 04:22
Permalink
most reliable canadian online pharmacies
https://canadianlpharmacy.com/ most reliable canadian online pharmacies
trust pharmacy canadian https://canadianlpharmacy.com/
canadian pharmaceuticals for usa sales https://canadianlpharmacy.com/
Astrid (not verified)
Tue, 2020-08-25 05:54
Permalink
Add new comment | Moi Verhole
Highly energetic article, I loved that a lot. Will there be
a part 2?
my webpage: free v bucks
April (not verified)
Tue, 2020-08-25 06:35
Permalink
Add new comment | Moi Verhole
Thanks to my father who told me on the topic of this blog,
this web site is really awesome.
my website ... v bucks free
AlfredoLow (not verified)
Mon, 2020-02-03 05:33
Permalink
aarp recommended canadian online pharmacies
https://viagracwithoutdoctor.com/ canadian pharmacy uk delivery
canadian pharmacy no prescription https://viagracwithoutdoctor.com/
canadian pharmacy world https://viagracwithoutdoctor.com/
Lin (not verified)
Tue, 2020-08-25 00:22
Permalink
Add new comment | Moi Verhole
I'm truly enjoying the design and layout of your blog.
It's a very easy on the eyes which makes it much more
enjoyable for me to come here and visit more often. Did you hire out a developer to create
your theme? Superb work!
my page :: free vbucks generator
Elouise (not verified)
Tue, 2020-08-25 03:00
Permalink
Add new comment | Moi Verhole
I will right away clutch your rss feed as I can't in finding your e-mail
subscription link or newsletter service.
Do you've any? Please let me realize in order that I may just subscribe.
Thanks.
my web page v bucks free
AlfredoLow (not verified)
Mon, 2020-02-03 06:39
Permalink
canada rx
https://canadianlpharmacy.com/ drugs for sale usa
drugs for sale on internet https://canadianlpharmacy.com/
canadian pharmacy viagra https://canadianlpharmacy.com/
AlfredoLow (not verified)
Mon, 2020-02-03 07:43
Permalink
online pharmacies in usa
https://viagrawwithoutdoctor.com/ canadian mail order pharmacies
canada online pharmacies https://viagrawwithoutdoctor.com/
canadian prescriptions online https://viagrawwithoutdoctor.com/
Luke (not verified)
Tue, 2020-08-25 01:56
Permalink
Add new comment | Moi Verhole
Hi i am kavin, its my first occasion to commenting anyplace, when i read this post i thought i could also make comment due to this good post.
Here is my homepage - free v bucks
Remona (not verified)
Tue, 2020-08-25 03:59
Permalink
Add new comment | Moi Verhole
Thanks for the good writeup. It in fact was a enjoyment account it.
Look complicated to more introduced agreeable from you!
However, how can we communicate?
Here is my web site :: free the vbucks
AlfredoLow (not verified)
Mon, 2020-02-03 08:46
Permalink
online pharmacies india
https://canadianlpharmacy.com/ canada medications buy
canadian medications pharmacy https://canadianlpharmacy.com/
canadian pharmaceuticals nafta https://canadianlpharmacy.com/
AlfredoLow (not verified)
Mon, 2020-02-03 09:51
Permalink
trust pharmacy canada reviews
https://canadianhpharmacy.com/ canadian pharmacy viagra
northwest pharmacies online https://canadianhpharmacy.com/
canada medication prices https://canadianhpharmacy.com/
AlfredoLow (not verified)
Mon, 2020-02-03 11:02
Permalink
canadian pharmacies online prescriptions
https://canadianhpharmacy.com/ northwestpharmacy
canadian medications list https://canadianhpharmacy.com/
canada rx https://canadianhpharmacy.com/
AlfredoLow (not verified)
Mon, 2020-02-03 12:08
Permalink
drugs for sale in mexico
https://viagrawwithoutdoctor.com/ canadian online pharmacies legal
canadian rx world pharmacy https://viagrawwithoutdoctor.com/
trust pharmacy canada https://viagrawwithoutdoctor.com/
AlfredoLow (not verified)
Mon, 2020-02-03 13:14
Permalink
canada medications information
https://canadianlpharmacy.com/ most reliable canadian online pharmacies
drugstore online reviews https://canadianlpharmacy.com/
buy viagrow https://canadianlpharmacy.com/
AlfredoLow (not verified)
Mon, 2020-02-03 14:08
Permalink
canadian online pharmacies reviews
https://canadianhpharmacy.com/ canadianpharmacyusa24h is it legal
canadian cialis https://canadianhpharmacy.com/
prescriptions from canada without https://canadianhpharmacy.com/
Muoi (not verified)
Tue, 2020-08-25 04:41
Permalink
Add new comment | Moi Verhole
It's very effortless to find out any topic on web
as compared to textbooks, as I found this paragraph at this website.
Also visit my web-site :: free the vbucks
AlfredoLow (not verified)
Mon, 2020-02-03 14:55
Permalink
online drug store
https://viagracwithoutdoctor.com/ trusted pharmacy canada
canada viagra https://viagracwithoutdoctor.com/
online pharmacies of canada https://viagracwithoutdoctor.com/
Shelton (not verified)
Wed, 2020-03-11 13:15
Permalink
Add new comment | Moi Verhole
Excellent blog here! Also your website loads up fast!
What web host are you using? Can I get your affiliate link
to your host? I wish my web site loaded up as quickly as yours
lol
carcased (Ernesto)
Myles (not verified)
Tue, 2020-08-25 06:08
Permalink
Add new comment | Moi Verhole
I'm impressed, I have to admit. Seldom do I come across a blog that's
equally educative and entertaining, and without a doubt, you have hit the nail on the head.
The problem is something too few people are speaking intelligently about.
I am very happy I came across this in my hunt for something relating to this.
my webpage: free vbucks generator
Mittie (not verified)
Tue, 2020-08-25 01:59
Permalink
Add new comment | Moi Verhole
Awesome article.
Feel free to visit my web site; v bucks free generator
Deb (not verified)
Tue, 2020-08-25 04:19
Permalink
Add new comment | Moi Verhole
It's hard to find educated people in this particular topic, but you sound like you know what you're talking
about! Thanks
Visit my web blog - free v bucks
Marlon (not verified)
Tue, 2020-08-25 05:04
Permalink
Add new comment | Moi Verhole
Hello There. I found your weblog using msn. This
is a very well written article. I will be sure to
bookmark it and come back to learn extra of your useful info.
Thank you for the post. I will definitely return.
My blog post free vbucks generator
Marlys (not verified)
Tue, 2020-08-25 06:48
Permalink
Add new comment | Moi Verhole
Hello, I think your website may be having web browser compatibility issues.
When I look at your blog in Safari, it looks fine but when opening in Internet Explorer, it's
got some overlapping issues. I simply wanted to provide you with a quick heads up!
Aside from that, excellent blog!
Check out my web site: free v bucks
AlfredoLow (not verified)
Mon, 2020-02-03 15:46
Permalink
canada medication pharmacy
https://canadianhpharmacy.com/ pharmacy canada best
buy viagra 25mg https://canadianhpharmacy.com/
canadian pharmacies online prescriptions https://canadianhpharmacy.com/
Deb (not verified)
Tue, 2020-08-25 01:41
Permalink
Add new comment | Moi Verhole
Amazing! Its really amazing post, I have got much clear idea about from this piece of writing.
Here is my webpage - free v bucks
AlfredoLow (not verified)
Mon, 2020-02-03 16:19
Permalink
canadian cialis
https://canadianhpharmacy.com/ are canadian online pharmacies safe
north west pharmacies canada https://canadianhpharmacy.com/
canadian pharmacies online prescriptions https://canadianhpharmacy.com/
AlfredoLow (not verified)
Mon, 2020-02-03 16:57
Permalink
canadian prescription drugstore
https://viagrawwithoutdoctor.com/ best canadian pharmacies online
drugs for sale deep web https://viagrawwithoutdoctor.com/
drugs for sale in uk https://viagrawwithoutdoctor.com/
Rosella (not verified)
Tue, 2020-08-25 00:37
Permalink
Add new comment | Moi Verhole
What i do not realize is in reality how you're now
not actually a lot more smartly-preferred than you may be now.
You're so intelligent. You realize therefore significantly relating to this
matter, produced me individually believe it from a lot of various
angles. Its like women and men aren't involved until it's one
thing to accomplish with Woman gaga! Your individual stuffs great.
Always take care of it up!
Also visit my web page; v bucks free
Wilbert (not verified)
Tue, 2020-08-25 03:25
Permalink
Add new comment | Moi Verhole
Wow, this piece of writing is pleasant, my younger sister is analyzing such things, therefore I am going to convey her.
Also visit my blog :: free v bucks
Mariano (not verified)
Tue, 2020-08-25 06:30
Permalink
Add new comment | Moi Verhole
Wonderful beat ! I would like to apprentice while you amend your web site, how can i subscribe for
a blog site? The account aided me a acceptable deal.
I had been tiny bit acquainted of this your
broadcast offered bright clear concept
Here is my webpage: free v bucks
Mae (not verified)
Tue, 2020-08-25 06:47
Permalink
Add new comment | Moi Verhole
I got this web site from my pal who informed me about this site
and now this time I am browsing this website and reading very informative posts at this place.
Here is my blog :: free the vbucks
AlfredoLow (not verified)
Mon, 2020-02-03 17:38
Permalink
canadian medications pharmacy
https://viagrawwithoutdoctor.com/ pharmacy onesource
canadian medications pharmacy https://viagrawwithoutdoctor.com/
how safe are canadian online pharmacies https://viagrawwithoutdoctor.com/
AlfredoLow (not verified)
Mon, 2020-02-03 18:21
Permalink
canada online pharmacies reviews
https://viagracwithoutdoctor.com/ canada drugs
canadian pharcharmy online24 https://viagracwithoutdoctor.com/
canadian medications by mail https://viagracwithoutdoctor.com/
Domenic (not verified)
Mon, 2020-08-24 23:40
Permalink
Add new comment | Moi Verhole
Hi there! I know this is kinda off topic but
I'd figured I'd ask. Would you be interested in exchanging
links or maybe guest writing a blog post or vice-versa?
My site covers a lot of the same topics as yours and I think we could greatly benefit from each other.
If you happen to be interested feel free to shoot me an email.
I look forward to hearing from you! Fantastic blog
by the way!
Here is my site marele pescar
Pages
Add new comment